Module: StreamHelpers

Defined in:
lib/rubyneat_dashboard/stream_helpers.rb

Class Method Summary collapse

Class Method Details

.wrap_for_sending(payload:, klass: :general, type: :message) ⇒ Object

Payload wrapper, giving the klass will be used for possible routing at the client level.



10
11
12
13
# File 'lib/rubyneat_dashboard/stream_helpers.rb', line 10

def wrap_for_sending(payload:, klass: :general, type: :message)
  pkt = JSON({payload: payload, klass: klass, type: type})
  "event:#{type}\ndata: #{pkt}\n\n"
end