aboutsummaryrefslogblamecommitdiffstats
path: root/actioncable/test/client/echo_channel.rb
blob: 63e35f194a1443f8a897a00fecc56a5f77e63239 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                              




                                   



                                                                
class EchoChannel < ActionCable::Channel::Base
  def subscribed
    stream_from "global"
  end

  def ding(data)
    transmit(dong: data['message'])
  end

  def delay(data)
    sleep 1
    transmit(dong: data['message'])
  end

  def bulk(data)
    ActionCable.server.broadcast "global", wide: data['message']
  end
end