module StreamHelpers

Public Instance Methods

wrap_for_sending(payload:, klass: :general, type: :message) click to toggle source

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

# 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