lib/faye/engines/memory.rb in faye-0.6.2 vs lib/faye/engines/memory.rb in faye-0.6.3
- old
+ new
@@ -1,9 +1,11 @@
module Faye
module Engine
class Memory < Base
+ include Timeouts
+
def initialize(options)
@namespace = Namespace.new
@clients = {}
@channels = {}
@messages = {}
@@ -34,14 +36,13 @@
def client_exists(client_id, &callback)
callback.call(@namespace.exists?(client_id))
end
def ping(client_id)
- timeout = @options[:timeout]
- return unless Numeric === timeout
- debug 'Ping ?, ?', client_id, timeout
+ return unless Numeric === @timeout
+ debug 'Ping ?, ?', client_id, @timeout
remove_timeout(client_id)
- add_timeout(client_id, 2 * timeout) { destroy_client(client_id) }
+ add_timeout(client_id, 2 * @timeout) { destroy_client(client_id) }
end
def subscribe(client_id, channel, &callback)
@clients[client_id] ||= Set.new
@clients[client_id].add(channel)