1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make the remote connection use the broadcaster as well

This commit is contained in:
David Heinemeier Hansson 2015-06-28 20:38:05 +02:00
parent 8a2af53c8e
commit a5d6bc0eb5
2 changed files with 10 additions and 8 deletions

View file

@ -10,18 +10,16 @@ module ActionCable
end
def disconnect
redis.publish internal_redis_channel, { type: 'disconnect' }.to_json
server.broadcast_without_logging internal_redis_channel, type: 'disconnect'
end
def identifiers
@server.connection_identifiers
end
def redis
@server.threaded_redis
server.connection_identifiers
end
private
attr_reader :server
def set_identifier_instance_vars(ids)
raise InvalidIdentifiersError unless valid_identifiers?(ids)
ids.each { |k,v| instance_variable_set("@#{k}", v) }

View file

@ -19,8 +19,12 @@ module ActionCable
@server, @channel = server, channel
end
def broadcast(message, log: true)
server.logger.info "[ActionCable] Broadcasting to #{channel}: #{message}" if log
def broadcast(message)
server.logger.info "[ActionCable] Broadcasting to #{channel}: #{message}"
broadcast_without_logging(message)
end
def broadcast_without_logging(message)
server.redis_for_threads.publish channel, message.to_json
end