Class: Pgbus::Web::Streamer::StreamEventDispatcher::StreamEnvelope
- Inherits:
-
Data
- Object
- Data
- Pgbus::Web::Streamer::StreamEventDispatcher::StreamEnvelope
- Defined in:
- lib/pgbus/web/streamer/stream_event_dispatcher.rb
Overview
An unwrapped stream broadcast. Similar shape to Pgbus::Client::ReadAfter::Envelope (msg_id + payload) so Connection#enqueue can consume either type via duck typing, but adds two delivery-control fields carried through from Pgbus::Streams::Stream#broadcast:
- `visible_to` — audience filter label (evaluated per-connection)
- `exclude` — a connection id to skip (actor-echo suppression:
the broadcaster's own SSE connection does not
receive the echo of its own broadcast)
The Dispatcher uses both to decide per-connection delivery; Connection never sees either field.
- `event` — the SSE `event:` name for the delivered frame.
nil means the default (turbo-stream); a typed
name (e.g. "presence", "reactive") lets clients
route without sniffing the HTML (issue #170).
Instance Attribute Summary collapse
-
#enqueued_at ⇒ Object
readonly
Returns the value of attribute enqueued_at.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#exclude ⇒ Object
readonly
Returns the value of attribute exclude.
-
#msg_id ⇒ Object
readonly
Returns the value of attribute msg_id.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#visible_to ⇒ Object
readonly
Returns the value of attribute visible_to.
Instance Method Summary collapse
-
#initialize(msg_id:, enqueued_at:, payload:, source:, visible_to: nil, exclude: nil, event: nil) ⇒ StreamEnvelope
constructor
A new instance of StreamEnvelope.
Constructor Details
#initialize(msg_id:, enqueued_at:, payload:, source:, visible_to: nil, exclude: nil, event: nil) ⇒ StreamEnvelope
Returns a new instance of StreamEnvelope.
59 60 61 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 59 def initialize(msg_id:, enqueued_at:, payload:, source:, visible_to: nil, exclude: nil, event: nil) super end |
Instance Attribute Details
#enqueued_at ⇒ Object (readonly)
Returns the value of attribute enqueued_at
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def enqueued_at @enqueued_at end |
#event ⇒ Object (readonly)
Returns the value of attribute event
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def event @event end |
#exclude ⇒ Object (readonly)
Returns the value of attribute exclude
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def exclude @exclude end |
#msg_id ⇒ Object (readonly)
Returns the value of attribute msg_id
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def msg_id @msg_id end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def payload @payload end |
#source ⇒ Object (readonly)
Returns the value of attribute source
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def source @source end |
#visible_to ⇒ Object (readonly)
Returns the value of attribute visible_to
58 59 60 |
# File 'lib/pgbus/web/streamer/stream_event_dispatcher.rb', line 58 def visible_to @visible_to end |