IOWebSocketClient class
WebSocket client backed by dart:io's built-in
WebSocket. Works on the Dart VM (server-side +
tests) and Flutter (iOS / Android / desktop).
- Implemented types
Constructors
Properties
-
closed
→ Future<
void> -
Future that completes when the connection is
closed (either by the server, the user via close,
or an error).
no setter
-
errors
→ Stream<
Object> -
Broadcast Stream of errors that occur on the
WebSocket. The message stream is silent on errors —
use this stream to observe them.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Whether the connection is open.
no setteroverride
-
messages
→ Stream<
WebSocketMessage> -
Broadcast Stream of incoming messages. Multiple
listeners are supported.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
{int? code, String? reason}) → Future< void> -
Closes the connection with
code(default 1000 = normal closure) and optionalreason.override -
connect(
Uri url, {Map< String, String> ? headers}) → Future<void> -
Opens a connection to
url. Theheaders(optional) are sent in theConnection: Upgraderequest (e.g. for auth).override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
WebSocketMessage message) → Future< void> -
Sends a WebSocketMessage. Throws StateError if
not connected.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited