WebSocket client interface.
- Implemented types
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the WebSocket connection is closed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → WebSocketClientState
-
The current state of the WebSocket connection.
no setter
- stateChanges → WebSocketStatesStream
-
Stream of state changes for the WebSocket connection.
final
- stream → WebSocketMessagesStream
-
Stream of message events handled by this WebSocket.
The stream provides messages as they are received from the network.
final
Methods
-
add(
Object data) → FutureOr< void> -
Sends data on the WebSocket connection.
The data in data must be either a String, or a List
override
-
close(
[int? code = 1000, String? reason = 'NORMAL_CLOSURE']) → FutureOr< void> -
Permanently stops the WebSocket connection and frees all resources.
After calling this method the WebSocket client is no longer usable.
override
-
connect(
String url) → FutureOr< void> -
Connects to the WebSocket server.
url
- the URL that was used to establish the connection. -
disconnect(
[int? code = 1000, String? reason = 'NORMAL_CLOSURE']) → FutureOr< void> -
Closes the WebSocket connection.
Set the optional
code
andreason
arguments to send close information to the remote peer. If they are omitted, the peer will seeNo Status Rcvd (1005)
code with no reason, indicates that no status code was provided even though one was expected. https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited