aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/connection/base.rb
diff options
context:
space:
mode:
authorDaniel Rhodes <rhodes.daniel@gmail.com>2016-03-17 15:05:06 +0100
committerDaniel Rhodes <rhodes.daniel@gmail.com>2016-04-05 15:55:59 +0200
commitcbd15da0274316bae64caae54880fee87853f480 (patch)
tree9911f491e182ab99d64351438f54e74cf21e24b8 /actioncable/lib/action_cable/connection/base.rb
parent85119f5909db86167b8b4ed6916b5dda6d9462d5 (diff)
downloadrails-cbd15da0274316bae64caae54880fee87853f480.tar.gz
rails-cbd15da0274316bae64caae54880fee87853f480.tar.bz2
rails-cbd15da0274316bae64caae54880fee87853f480.zip
Added protocol negotiation
This is primarily for backwards compatibility for when or if the protocol is changed in future versions. If the server fails to respond with an acceptable protocol, the client disconnects and disables the monitor.
Diffstat (limited to 'actioncable/lib/action_cable/connection/base.rb')
-rw-r--r--actioncable/lib/action_cable/connection/base.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb
index b4488265cb..43c83b4b78 100644
--- a/actioncable/lib/action_cable/connection/base.rb
+++ b/actioncable/lib/action_cable/connection/base.rb
@@ -48,7 +48,7 @@ module ActionCable
include InternalChannel
include Authorization
- attr_reader :server, :env, :subscriptions, :logger, :worker_pool
+ attr_reader :server, :env, :subscriptions, :logger, :worker_pool, :protocol
delegate :event_loop, :pubsub, to: :server
def initialize(server, env)
@@ -153,6 +153,7 @@ module ActionCable
private
def handle_open
+ @protocol = websocket.protocol
connect if respond_to?(:connect)
subscribe_to_internal_channel
send_welcome_message