FakeWebSocketConnection class final

The server side of one fake connection.

Properties

autoPong ↔ bool
Answer client pings automatically.
getter/setter pair
bufferedAmount ↔ int
What the client sees as its send queue size. Set it above the client's sendHighWaterMark to make push() wait, then call drain.
getter/setter pair
clientClose ↔ ({int? code, String? reason})?
The close code and reason the client sent, once it did.
getter/setter pair
echoClose ↔ bool
Answer the client's close frame automatically. Set to false to test the disconnect timeout.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isEnded → bool
Whether the connection ended.
no setter
isOpen → bool
Whether the connection is open (accepted and not ended).
no setter
messages → Stream<Object>
Messages from the client as they arrive.
no setter
pings ↔ int
Pings received from the client.
getter/setter pair
received → List<Object>
Messages from the client: String for text, Uint8List for binary.
no setter
receivedJson → Iterable<Object?>
Text messages from the client decoded as JSON.
no setter
request → TransportRequest
What the client asked for.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

accept({String? protocol}) → void
Completes the handshake.
close([int? code = 1000, String reason = '']) → void
Starts a server-side close; the connection ends with code.
drain() → void
Empties the simulated send queue; a waiting push() completes.
drop() → void
The connection is lost without a close frame (code 1006).
fail(WebSocketException error) → void
Ends the connection with error (e.g. a network failure).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pong() → void
Sends a pong.
reject(int statusCode, {Map<String, String> headers = const {}}) → void
Fails the handshake with HTTP statusCode.
sendBinary(Uint8List bytes) → void
Sends a binary message.
sendJson(Object? value) → void
Sends value encoded as JSON text.
sendText(String text) → void
Sends a text message to the client.
sendTextBytes(Uint8List bytes) → void
Sends raw text bytes (may be invalid UTF-8, for tests).
toString() → String
A string representation of this object.
inherited

Operators

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