Class: WhereIsWaldo::RosterDelivery::Broadcast

Inherits:
Base
  • Object
show all
Defined in:
app/services/where_is_waldo/roster_delivery.rb

Overview

Instant push to a single shared per-account stream. NO visibility filtering — everyone in the account sees everyone. O(1) per transition.

Instance Method Summary collapse

Methods inherited from Base

#poll_messages

Instance Method Details

#on_transition(subject_id) ⇒ Object



64
65
66
# File 'app/services/where_is_waldo/roster_delivery.rb', line 64

def on_transition(subject_id)
  Roster.publish(subject_id)
end

#subscribe_plan(subject, _session_id) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'app/services/where_is_waldo/roster_delivery.rb', line 53

def subscribe_plan(subject, _session_id)
  org = config.resolve_roster_org(subject)
  stream = Roster.stream_name(org)
  return { streams: [], messages: [] } unless stream

  {
    streams: [stream],
    messages: [Roster.snapshot_message(Roster.snapshot(org), mode: :broadcast)]
  }
end