pub struct Event {
pub name: String,
pub payload: Value,
}Expand description
A decoded typed room event: a name plus its JSON payload. Produced by
Connection::recv from an enveloped Frame::Event.
Fields§
§name: StringThe event name the publisher broadcast/sent under.
payload: ValueThe event’s JSON payload (Value::Null if the publisher sent none).
Implementations§
Source§impl Event
impl Event
Sourcepub fn decode(frame: &Frame) -> Option<Event>
pub fn decode(frame: &Frame) -> Option<Event>
Decode a frame into a typed event, or None if the frame is not a named
event envelope (a presence delta, a DocSync blob, or a raw publish_event
value with no envelope). Non-events are skipped by the typed reader, never
surfaced as bogus zero-name events.
Public so a consumer that subscribes to the raw Frame stream (because it
must also relay presence/DocSync frames the typed Connection skips) can
still recognise and unwrap typed named events off the shared broadcast — the
WS gateway’s fan-out path is exactly such a consumer.