Module: Pakyow::Application::Helpers::Realtime::Subscriptions
- Defined in:
- lib/pakyow/application/helpers/realtime/subscriptions.rb
Instance Method Summary collapse
Instance Method Details
#subscribe(channel, *qualifiers) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pakyow/application/helpers/realtime/subscriptions.rb', line 10 def subscribe(channel, *qualifiers) channels = if qualifiers.empty? Pakyow::Realtime::Channel.new(channel) else qualifiers.map { |qualifier| Pakyow::Realtime::Channel.new(channel, qualifier) } end app.websocket_server.socket_subscribe(socket_client_id, *channels) end |
#unsubscribe(channel, *qualifiers) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pakyow/application/helpers/realtime/subscriptions.rb', line 22 def unsubscribe(channel, *qualifiers) channels = if qualifiers.empty? Pakyow::Realtime::Channel.new(channel, "*") else qualifiers.map { |qualifier| Pakyow::Realtime::Channel.new(channel, qualifier) } end app.websocket_server.socket_unsubscribe(*channels) end |