ChannelMessage class

Structured channel message with protocol metadata

Constructors

ChannelMessage({required String id, required String channel, required ChannelMessageDirection direction, ChannelMessageType type = ChannelMessageType.message, required dynamic payload, required DateTime timestamp, int? sequence})
const
ChannelMessage.fromJson(Map<String, dynamic> json)
Create from JSON
factory
ChannelMessage.inbound(String channel, dynamic payload, {int? sequence, ChannelMessageType type = ChannelMessageType.message})
Create an inbound (server-to-client) message
factory
ChannelMessage.outbound(String channel, dynamic payload, {int? sequence, ChannelMessageType type = ChannelMessageType.message})
Create an outbound (client-to-server) message
factory

Properties

channel String
Channel this message belongs to
final
direction ChannelMessageDirection
Message direction
final
hashCode int
The hash code for this object.
no setterinherited
id String
Unique message identifier
final
payload → dynamic
Message payload data
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sequence int?
Optional sequence number for ordering
final
timestamp DateTime
Timestamp when the message was created
final
type ChannelMessageType
Message type
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Convert to JSON
toString() String
A string representation of this object.
override

Operators

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