aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/connection/web_socket.rb
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2016-04-05 09:12:55 -0700
committerJeremy Daer <jeremydaer@gmail.com>2016-04-05 09:26:11 -0700
commitfa3537506a12635b51886919589211640ddd3a15 (patch)
tree2774b5ac7e58d63284a05ea33bfc1a9242a6edc5 /actioncable/lib/action_cable/connection/web_socket.rb
parentfca51a7c031b4f17f7a2f353fcfc8a748f6ada7f (diff)
parentcbd15da0274316bae64caae54880fee87853f480 (diff)
downloadrails-fa3537506a12635b51886919589211640ddd3a15.tar.gz
rails-fa3537506a12635b51886919589211640ddd3a15.tar.bz2
rails-fa3537506a12635b51886919589211640ddd3a15.zip
Merge pull request #24224 from danielrhodes/actioncable-websocket-protocols
ActionCable protocol negotiation
Diffstat (limited to 'actioncable/lib/action_cable/connection/web_socket.rb')
-rw-r--r--actioncable/lib/action_cable/connection/web_socket.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb
index 0bec9b6a96..11f28c37e8 100644
--- a/actioncable/lib/action_cable/connection/web_socket.rb
+++ b/actioncable/lib/action_cable/connection/web_socket.rb
@@ -4,8 +4,8 @@ module ActionCable
module Connection
# Wrap the real socket to minimize the externally-presented API
class WebSocket
- def initialize(env, event_target, event_loop, client_socket_class)
- @websocket = ::WebSocket::Driver.websocket?(env) ? client_socket_class.new(env, event_target, event_loop) : nil
+ def initialize(env, event_target, event_loop, client_socket_class, protocols: ActionCable::INTERNAL[:protocols])
+ @websocket = ::WebSocket::Driver.websocket?(env) ? client_socket_class.new(env, event_target, event_loop, protocols) : nil
end
def possible?
@@ -24,6 +24,10 @@ module ActionCable
websocket.close
end
+ def protocol
+ websocket.protocol
+ end
+
def rack_response
websocket.rack_response
end