diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-21 21:41:43 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-21 21:41:43 +0200 |
commit | f8638f789a1cbd33205cdce0dd24f2aee3d69a25 (patch) | |
tree | e74aa3d22b3900edae1ff6d14ba5d96a2497ff75 /lib/action_cable | |
parent | 22b9882ea6ab621ac5deceb700ec503f796812e6 (diff) | |
download | rails-f8638f789a1cbd33205cdce0dd24f2aee3d69a25.tar.gz rails-f8638f789a1cbd33205cdce0dd24f2aee3d69a25.tar.bz2 rails-f8638f789a1cbd33205cdce0dd24f2aee3d69a25.zip |
Rename callback hooks to match setup
And make it all private
Diffstat (limited to 'lib/action_cable')
-rw-r--r-- | lib/action_cable/connection/base.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb index 175b596241..f6beda1c57 100644 --- a/lib/action_cable/connection/base.rb +++ b/lib/action_cable/connection/base.rb @@ -33,7 +33,7 @@ module ActionCable @websocket.on(:open) do |event| transmit_ping_timestamp @ping_timer = EventMachine.add_periodic_timer(PING_INTERVAL) { transmit_ping_timestamp } - worker_pool.async.invoke(self, :initialize_connection) + worker_pool.async.invoke(self, :on_open) end @websocket.on(:message) do |event| @@ -51,7 +51,7 @@ module ActionCable @websocket.on(:close) do |event| logger.info finished_request_message - worker_pool.async.invoke(self, :close_connection) + worker_pool.async.invoke(self, :on_close) EventMachine.cancel_timer(@ping_timer) if @ping_timer end @@ -110,7 +110,9 @@ module ActionCable request.cookie_jar end - def initialize_connection + + private + def on_open server.add_connection(self) connect if respond_to?(:connect) @@ -120,7 +122,7 @@ module ActionCable worker_pool.async.invoke(self, :receive, @pending_messages.shift) until @pending_messages.empty? end - def close_connection + def on_close server.remove_connection(self) cleanup_subscriptions |