aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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