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
- Host: GitHub
- URL: https://github.com/mr-dxdy/action_channels
- Owner: mr-dxdy
- License: mit
- Created: 2018-02-09T14:25:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-26T09:16:16.000Z (about 8 years ago)
- Last Synced: 2025-02-10T14:13:51.164Z (over 1 year ago)
- Topics: nio4r, ruby, websockets
- Language: Ruby
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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
```