lib/pusher-client/socket.rb in pusher-client-0.6.0 vs lib/pusher-client/socket.rb in pusher-client-0.6.1
- old
+ new
@@ -19,11 +19,11 @@
@socket_id = nil
@channels = Channels.new
@global_channel = Channel.new('pusher_global_channel')
@global_channel.global = true
@connected = false
- @encrypted = options[:encrypted] || false
+ @encrypted = options[:encrypted] || options[:secure] || false
@logger = options[:logger] || PusherClient.logger
# :private_auth_method is deprecated
@auth_method = options[:auth_method] || options[:private_auth_method]
@cert_file = options[:cert_file]
@ws_host = options[:ws_host] || HOST
@@ -201,15 +201,17 @@
})
logger.debug("Websocket connected")
loop do
- msg = @connection.receive.first
- next if msg.nil?
- params = parser(msg)
- next if params['socket_id'] && params['socket_id'] == self.socket_id
+ @connection.receive.each do |msg|
+ params = parser(msg)
- send_local_event(params['event'], params['data'], params['channel'])
+ # why ?
+ next if params['socket_id'] && params['socket_id'] == self.socket_id
+
+ send_local_event(params['event'], params['data'], params['channel'])
+ end
end
end
def send_local_event(event_name, event_data, channel_name=nil)
if channel_name