Module: Mycel::Channel::Message
- Defined in:
- lib/mycel.rb
Overview
Wire-message constructors. String keys are used throughout so the same Hash shape survives encode → bytes → decode without symbol/ string drift (JSON.parse always yields String keys).
Class Method Summary collapse
Class Method Details
.generate_msg(type, id) ⇒ Object
397 398 399 |
# File 'lib/mycel.rb', line 397 def self.generate_msg(type, id) { 'v' => PROTOCOL_VERSION, 'type' => type, 'id' => id } end |
.generate_payload_msg(type, id, payload) ⇒ Object
401 402 403 |
# File 'lib/mycel.rb', line 401 def self.generate_payload_msg(type, id, payload) { 'v' => PROTOCOL_VERSION, 'type' => type, 'id' => id, 'payload' => payload } end |