An open API service indexing awesome lists of open source software.

https://github.com/mr-dxdy/action_channels


https://github.com/mr-dxdy/action_channels

nio4r ruby websockets

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# Action channels

## Example

``` ruby
require 'action_channels'

class PingPongChannel < ActionChannels::Channels::Base
def process_custom_message(message)
case message.type
when 'ping'
send_message message.author, ActionChannels::Message.new(channel: name, type: 'pong')
when 'pong'
send_message message.author, ActionChannels::Message.new(channel: name, type: 'ping')
else
on_unknown_type_message message
end
end
end

server = ActionChannels::Server.new(
port: 3050,
channels: [PingPongChannel.new(name: 'ping-pong')]
)

server.run
```