WebSocketClientFake class final Testing

Fake WebSocket client for testing purposes.

Implemented types
Annotations
  • @visibleForTesting

Constructors

WebSocketClientFake({Iterable<String>? protocols})
Fake WebSocket client for testing purposes.

Properties

hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether the WebSocket connection is closed.
no setteroverride
protocols List<String>?
List of protocols to be used in the WebSocket connection.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state WebSocketClientState
The current state of the WebSocket connection.
no setteroverride
stateChanges WebSocketStatesStream
Stream of state changes for the WebSocket connection.
latefinal
stream WebSocketMessagesStream
Stream of message events handled by this WebSocket. The stream provides messages as they are received from the network.
no setteroverride

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.
override
disconnect([int? code = 1000, String? reason = 'NORMAL_CLOSURE']) FutureOr<void>
Closes the WebSocket connection. Set the optional code and reason arguments to send close information to the remote peer. If they are omitted, the peer will see No 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
override
loopBack(Object data) → void
Emulate receiving data from the server.
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