Permalink
Browse files

json fix

  • Loading branch information...
jana4u committed Mar 28, 2012
1 parent 1d214c5 commit 4355c92eb712f8eebcbbc317f253f79b8e739391
Showing with 8 additions and 8 deletions.
  1. +8 −8 lib/juggernaut/client.rb
View
@@ -40,19 +40,19 @@ def find_by_id(id)
def find_by_signature(signature)
# signature should be unique
- find do |client|
+ find do |client|
client.connections.select { |connection| connection.signature == signature }.any?
end.first
end
def find_by_channels(channels)
- find do |client|
+ find do |client|
client.has_channels?(channels)
end
end
def find_by_id_and_channels(id, channels)
- find do |client|
+ find do |client|
client.has_channels?(channels) && client.id == id
end.first
end
@@ -99,12 +99,12 @@ def initialize(subscriber, request)
add_new_connection(subscriber)
end
- def to_json
+ def to_json(*args)
{
- :client_id => @id,
+ :client_id => @id,
:num_connections => @connections.size,
:session_id => @session_id
- }.to_json
+ }.to_json(args)
end
def add_new_connection(subscriber)
@@ -135,7 +135,7 @@ def logout_request
return true unless options[:logout_url]
post_request(options[:logout_url], [ ], :timeout => options[:post_request_timeout] || 5)
end
-
+
def remove_connection(connection)
@connections.delete(connection)
self.reset_logout_timeout!
@@ -231,7 +231,7 @@ def post_request(url, channels = [ ], options = { })
logger.error("#{url.to_s} timeout")
return false
end
- end
+ end
def send_message_to_connections(msg, channels)
@connections.each do |connection|

0 comments on commit 4355c92

Please sign in to comment.