Method: Litecable#broadcast

Defined in:
lib/litestack/litecable.rb

#broadcast(channel, payload = nil) ⇒ Object

broadcast a message to a specific channel



31
32
33
34
35
36
37
# File 'lib/litestack/litecable.rb', line 31

def broadcast(channel, payload = nil)
  # group meesages and only do broadcast every 10 ms
  # but broadcast locally normally
  @messages.acquire { |msgs| msgs << [channel.to_s, Oj.dump(payload)] }
  capture(:broadcast, channel)
  local_broadcast(channel, payload)
end