summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-05-30 11:42:54 +0100
committerPhil Hughes <me@iamphill.com>2016-05-30 11:42:54 +0100
commit2a53154049a477539d47569dfe4ab8e09eb7f632 (patch)
tree639b2a4dceca9e0c533bb829bee2b739f1a62b09
parent02fff124caa2c3fa79e057de427b6beba0a6531f (diff)
downloadgitlab-ce-websockets.tar.gz
Changed socket pathwebsockets
-rw-r--r--scripts/socket.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/scripts/socket.rb b/scripts/socket.rb
index 5e0b1725702..2a9f31dda51 100644
--- a/scripts/socket.rb
+++ b/scripts/socket.rb
@@ -4,7 +4,7 @@ require "json"
EM.run do
@channels = Hash.new
- @redis = EM::Hiredis.connect("unix:///Users/phil/Projects/gdk-ce/redis/redis.socket")
+ @redis = EM::Hiredis.connect("unix://#{File.expand_path('..')}/redis/redis.socket")
pubsub = @redis.pubsub
pubsub.subscribe "todos"
pubsub.on(:message) do |redis_channel, message|
@@ -15,11 +15,8 @@ EM.run do
}
if redis_channel == "todos"
- @channels.each do |key, channel|
- if channel[:user_id].to_i == message["user_id"]
- channel[:channel].push data.to_json
- end
- end
+ channel = @channels[message["user_id"].to_s]
+ channel[:channel].push data.to_json
end
end