SocketTransport class
The transport layer used to perform JSON-RPC 2 requests.
A client calls methods on a server and handles the server's responses to
those method calls. Methods can be called with sendRequest
.
Constructors
Properties
- connected → bool
-
Check if we are currently connected with the socket.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- protocol → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
subscriptions
→ List<
String> -
final
- url → String
-
final
- version → int
-
final
Methods
-
ack(
{required String topic}) → void - Send an ack.
-
close(
{bool forceClose = false}) → Future - Closes the web socket connection.
-
getWebSocketUrl(
{required String url, required String protocol, required String version}) → String - Get the websocket url based on a given url.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
on<
T> (String eventName, OnEvent< T> callback) → void - Listen to events.
-
open(
{OnSocketOpen? onOpen, OnSocketClose? onClose}) → void - Open a new connection to a web socket server.
-
send(
{required Map< String, dynamic> payload, required String topic, bool silent = false}) → bool - Send a given payload to the server. The payload is json-encoded before sending.
-
subscribe(
{required String topic}) → void - Subscribe to a given topic.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited