diff options
author | Phil Hughes <me@iamphill.com> | 2016-05-30 11:42:54 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-05-30 11:42:54 +0100 |
commit | 2a53154049a477539d47569dfe4ab8e09eb7f632 (patch) | |
tree | 639b2a4dceca9e0c533bb829bee2b739f1a62b09 | |
parent | 02fff124caa2c3fa79e057de427b6beba0a6531f (diff) | |
download | gitlab-ce-websockets.tar.gz |
Changed socket pathwebsockets
-rw-r--r-- | scripts/socket.rb | 9 |
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 |