WebSocketClient class
High-level WebSocket client that integrates all plugin features: heartbeat, reconnection, interceptors, message queue, ACK, and topic channels.
Constructors
- WebSocketClient(WebSocketAdapter _adapter)
Properties
- config → WebSocketConfig
-
no setter
-
connectionStats
→ Map<
String, dynamic> -
no setter
- currentState → WebSocketState
-
no setter
- errorStream → Stream
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
no setter
- isConnected → bool
-
no setter
- isConnecting → bool
-
no setter
-
logStream
→ Stream<
String> -
no setter
-
messageStream
→ Stream<
WebSocketMessage> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stateStream
→ Stream<
WebSocketState> -
no setter
-
statsStream
→ Stream<
Map< String, dynamic> > -
no setter
Methods
-
addInterceptor(
WebSocketInterceptor interceptor) → void - Adds an interceptor to the end of the chain.
-
channel(
String topic) → WebSocketTopic -
Returns (or creates) a WebSocketTopic for
topic. -
connect(
) → Future< void> -
disconnect(
[int? code, String? reason]) → Future< void> -
dispose(
) → Future< void> -
forceReconnect(
) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeInterceptor(
WebSocketInterceptor interceptor) → void - Removes a previously added interceptor.
-
send(
dynamic data) → Future< void> - Sends raw data (string, binary, or any dart object).
-
sendBinary(
List< int> bytes) → Future<void> -
sendJson(
Map< String, dynamic> json) → Future<void> -
sendMessage(
WebSocketMessage message, {bool useAck = false}) → Future< void> - Sends a WebSocketMessage. Runs interceptors, queues if offline, and optionally tracks ACK.
-
sendText(
String text) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited