Module: Gamefic::Mud::Adapter::Websocket
- Includes:
- Common
- Defined in:
- lib/gamefic-mud/adapter/websocket.rb
Overview
The WebSocket client adapter module.
Instance Attribute Summary
Attributes included from Common
Instance Method Summary collapse
Methods included from Common
Instance Method Details
#send_raw(data) ⇒ void
This method returns an undefined value.
22 23 24 25 26 |
# File 'lib/gamefic-mud/adapter/websocket.rb', line 22 def send_raw data # Convert raw text to a hash with a `messages` key so the WebSocket # client can rely on a single standard for incoming data. update({messages: data}) end |
#update(output) ⇒ void
This method returns an undefined value.
13 14 15 16 17 18 |
# File 'lib/gamefic-mud/adapter/websocket.rb', line 13 def update output # Websocket connections are assumed to be rich clients. Send them # the entire output hash and let them determine how to render the # data. send output.to_json end |