diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-22 16:53:00 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-06-22 16:53:00 +0200 |
commit | 6726c11cda7a970ca02fd690ea7b5063fcfba7bc (patch) | |
tree | 6d6b62a4f8bb76355f5ce3e1e1f8dc3987dd43f5 /lib | |
parent | f91e39429a4f08e4d78196ddcb12dc2930d07d92 (diff) | |
download | rails-6726c11cda7a970ca02fd690ea7b5063fcfba7bc.tar.gz rails-6726c11cda7a970ca02fd690ea7b5063fcfba7bc.tar.bz2 rails-6726c11cda7a970ca02fd690ea7b5063fcfba7bc.zip |
Composed method to same order of abstraction
Diffstat (limited to 'lib')
-rw-r--r-- | lib/action_cable/connection/base.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb index 0fb98d7293..252b71e847 100644 --- a/lib/action_cable/connection/base.rb +++ b/lib/action_cable/connection/base.rb @@ -24,8 +24,8 @@ module ActionCable def process logger.info started_request_message - @websocket = Faye::WebSocket.new(@env) if websocket_request? + websocket_initialization websocket.on(:open) { |event| send_async :on_open } websocket.on(:message) { |event| on_message event.data } @@ -111,6 +111,10 @@ module ActionCable end + def websocket_initialization + @websocket = Faye::WebSocket.new(@env) + end + def websocket_alive? websocket && websocket.ready_state == Faye::WebSocket::API::OPEN end |