From f51cb7eef5be8e3496ea653fec04bedd6e5ec334 Mon Sep 17 00:00:00 2001 From: Daniel Rhodes Date: Tue, 1 Mar 2016 01:21:19 +0100 Subject: Added welcome message type and fix test hacks --- actioncable/lib/action_cable/connection/base.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actioncable/lib/action_cable/connection') diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb index 60f3ad3e06..7a9507fbd9 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -154,7 +154,7 @@ module ActionCable def handle_open connect if respond_to?(:connect) subscribe_to_internal_channel - confirm_connection_monitor_subscription + send_welcome_message message_buffer.process! server.add_connection(self) @@ -173,11 +173,11 @@ module ActionCable disconnect if respond_to?(:disconnect) end - def confirm_connection_monitor_subscription - # Send confirmation message to the internal connection monitor channel. + def send_welcome_message + # Send welcome message to the internal connection monitor channel. # This ensures the connection monitor state is reset after a successful # websocket connection. - transmit ActiveSupport::JSON.encode(identifier: ActionCable::INTERNAL[:identifiers][:ping], type: ActionCable::INTERNAL[:message_types][:confirmation]) + transmit ActiveSupport::JSON.encode(type: ActionCable::INTERNAL[:message_types][:welcome]) end def allow_request_origin? -- cgit v1.2.3 From 53e163dc3fd2c77c7967534665e81e0ef40df580 Mon Sep 17 00:00:00 2001 From: Daniel Rhodes Date: Tue, 1 Mar 2016 02:48:15 +0100 Subject: Make ping into a message type This change makes ping into a message type, which makes the whole protocol a lot more consistent. Also fixes hacks on the client side to make this all work. --- actioncable/lib/action_cable/connection/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actioncable/lib/action_cable/connection') diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb index 7a9507fbd9..79253ef4ef 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -114,7 +114,7 @@ module ActionCable end def beat - transmit ActiveSupport::JSON.encode(identifier: ActionCable::INTERNAL[:identifiers][:ping], message: Time.now.to_i) + transmit ActiveSupport::JSON.encode(type: ActionCable::INTERNAL[:message_types][:ping], message: Time.now.to_i) end def on_open # :nodoc: -- cgit v1.2.3