aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-04-06 13:17:02 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-04-06 13:17:02 -0500
commit1c9d82dbf0e743534c5fa9be936eaa46c5b07523 (patch)
tree4fc5c31666fa033859150852cc5fd583420e32d8 /lib/action_cable/connection
parenteec92d0229a7bceb62d49d58c70b5629fe140d7f (diff)
downloadrails-1c9d82dbf0e743534c5fa9be936eaa46c5b07523.tar.gz
rails-1c9d82dbf0e743534c5fa9be936eaa46c5b07523.tar.bz2
rails-1c9d82dbf0e743534c5fa9be936eaa46c5b07523.zip
Add remote connection to talk over internal redis channel
Diffstat (limited to 'lib/action_cable/connection')
-rw-r--r--lib/action_cable/connection/identifier.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/action_cable/connection/identifier.rb b/lib/action_cable/connection/identifier.rb
new file mode 100644
index 0000000000..9bfd773ab1
--- /dev/null
+++ b/lib/action_cable/connection/identifier.rb
@@ -0,0 +1,19 @@
+module ActionCable
+ module Connection
+ module Identifier
+
+ def internal_redis_channel
+ "action_cable/#{connection_identifier}"
+ end
+
+ def connection_identifier
+ @connection_identifier ||= connection_gid identifiers.map { |id| instance_variable_get("@#{id}")}
+ end
+
+ def connection_gid(ids)
+ ids.map {|o| o.to_global_id.to_s }.sort.join(":")
+ end
+
+ end
+ end
+end