diff options
author | Matthew Draper <matthew@trebex.net> | 2016-03-02 19:16:28 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-03-02 19:17:57 +1030 |
commit | fc1b32f8d1d26e41fa79d7a38c852acae24c77a0 (patch) | |
tree | d414a29907719bea99b1f10783820fa136bda209 /actioncable/lib/action_cable/connection | |
parent | 1fdc83947be8b7e8838419a72f6f7b71ee63ac35 (diff) | |
parent | 53e163dc3fd2c77c7967534665e81e0ef40df580 (diff) | |
download | rails-fc1b32f8d1d26e41fa79d7a38c852acae24c77a0.tar.gz rails-fc1b32f8d1d26e41fa79d7a38c852acae24c77a0.tar.bz2 rails-fc1b32f8d1d26e41fa79d7a38c852acae24c77a0.zip |
Merge pull request #23976 from danielrhodes/enhancement/ac-ping-to-message-type
ActionCable: Add a "welcome" and "ping" message type
Diffstat (limited to 'actioncable/lib/action_cable/connection')
-rw-r--r-- | actioncable/lib/action_cable/connection/base.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb index afe0d958d7..f34f5eb109 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -115,7 +115,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: @@ -155,7 +155,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) @@ -174,11 +174,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? |