WebSocketTopic class

A logical sub-channel scoped to a specific topic name.

Messages are exchanged using an envelope format: {"topic": "<topic>", "event": "<event>", "payload": <payload>}

Obtain an instance via WebSocketClient.channel.

Constructors

WebSocketTopic({required String topic, required Future<void> sender(String topic, String event, dynamic payload)})

Properties

hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
no setter
messageStream Stream<WebSocketMessage>
Stream of messages received on this topic.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
topic String
final

Methods

dispose() Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
push(WebSocketMessage message) → void
Pushes a received message into this topic's stream. Called by ChannelManager.
send(String event, dynamic payload) Future<void>
Sends payload to the server under this topic with the given event name.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited