Message class abstract
Base class for all messages exchanged over a connection.
Defines only the frames shared by every communication mode (PingMessage, PongMessage, ErrorMessage); mode-specific protocols add their own subclasses.
Constructors
- Message(MessageTypeValue type, String documentId)
-
Constructor
const
- Message.error({required String documentId, required String code, required String message})
-
Create an error message
factory
- Message.ping({required String documentId, required int timestamp, VersionVector? versionVector})
-
Create a ping message
factory
- Message.pong({required String documentId, required int originalTimestamp, required int responseTimestamp})
-
Create a pong message
factory
Properties
- documentId → String
-
The document ID to which the message refers
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → MessageTypeValue
-
The message type
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
serialize(
) → String - Serialize the message to a JSON string
-
toJson(
) → Map< String, dynamic> - Convert the message to a JSON map
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromJson(
Map< String, dynamic> json) → Message? - Deserialize a shared message (PingMessage, PongMessage, ErrorMessage) from a JSON string.
-
getTypeOrNull(
List< int> data) → int? -
Safely reads the raw
typecode of an encoded messagedataframe, without throwing.