lib/jugglite/app.rb in jugglite-0.2.0 vs lib/jugglite/app.rb in jugglite-0.3.0

- old
+ new

@@ -15,10 +15,11 @@ # +keepalive_timeout+ : the timeout in seconds between keepalive comments def initialize(app = nil, options = {}) @app = app @options = { path: '/stream', + namespace: '', keepalive_timeout: 20 }.merge(options) @subscription_map = {} EventMachine::next_tick { setup_redis } EventMachine::next_tick { setup_keepalive } @@ -75,11 +76,12 @@ end end def channels_for_request(request) # TODO: Sanitize? Check signature? - channel = Array(request.params["channel"]) - Set.new(channel) + channels = Array(request.params["channel"]) + channels.map! { |channel| @options[:namespace] + channel } + Set.new(channels) end def register_connection(connection) requested_channels = channels_for_request(connection.request) subscribe_to_new_channels(requested_channels - @redis_channels)