aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2015-06-22 16:53:00 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2015-06-22 16:53:00 +0200
commit6726c11cda7a970ca02fd690ea7b5063fcfba7bc (patch)
tree6d6b62a4f8bb76355f5ce3e1e1f8dc3987dd43f5 /lib
parentf91e39429a4f08e4d78196ddcb12dc2930d07d92 (diff)
downloadrails-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.rb6
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