LikeWebSocketClient class

Managed WebSocket client for the LIKE package.

Features auto-reconnect, token synchronization, ping-pong heartbeats, and automatic dispatch of incoming events to the LikePipeline. State changes and connection handshakes are synchronized sequentially to prevent races.

Constructors

LikeWebSocketClient({required String url, Future<String?> getToken()?, Duration reconnectInterval = const Duration(seconds: 5), Duration pingInterval = const Duration(seconds: 30), String pingPayload = '{"type":"ping"}'})

Properties

getToken Future<String?> Function()?
final
hashCode int
The hash code for this object.
no setterinherited
isConnected bool
Returns true if the WebSocket is currently open.
no setter
messages Stream
Stream of decoded JSON/string messages received from the server.
no setter
pingInterval Duration
final
pingPayload String
final
reconnectInterval Duration
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String
final

Methods

connect() Future<void>
Connects to the WebSocket server sequentially.
disconnect() Future<void>
Disconnects from the WebSocket server sequentially.
dispose() Future<void>
Disposes of the client and cleans up resources sequentially.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(dynamic message) Future<void>
Sends a message down the socket channel sequentially.
toString() String
A string representation of this object.
inherited

Operators

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