WsAdapter class abstract
The WsAdapter class is used to create a new web socket adapter
Constructors
- WsAdapter(HttpAdapter httpAdapter)
- The WsAdapter constructor is used to create a new instance of the WsAdapter class.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpAdapter → HttpAdapter
-
The httpAdapter property contains the HTTP adapter used by the WebSocket adapter.
It is used to get the requests and responses for the WebSocket connections.
final
- isOpen → bool
-
The isOpen property contains the status of the adapter.
no setterinherited
- name → String
-
The name property contains the name of the adapter.
The name is used to identify the adapter in the application and also to understand the type of request that is being handled.
no setterinherited
- router ↔ Atlas?
-
The router property contains the router used by the WebSocket adapter.
It is used to handle the WebSocket requests and responses.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
server
↔ Map<
String, WebSocket> ? -
The server property contains the server.
getter/setter pairinherited
Methods
-
bindClientConnection(
{required String clientId, required WebSocket socket, required IncomingMessage request, required GatewayScope gatewayScope}) → void -
bindClientConnectionsis used to bind the client connection to the WebSocket adapter triggering theonClientConnectmethod of the WebSocketGateway. -
bindClientDisconnection(
{required String clientId, required IncomingMessage request, required GatewayScope gatewayScope, required Map< String, dynamic> params}) → void -
bindClientDisconnection is used to bind the client disconnection to the WebSocket adapter triggering the
onClientDisconnectmethod of the WebSocketGateway. -
bindMessageHandler(
{required String clientId, required IncomingMessage request, required GatewayScope gatewayScope, required Map< String, dynamic> params, required OutgoingMessage response}) → Future<void> -
bindMessageHandler is used to bind the message handler to the WebSocket adapter.
It listens for messages from the client and calls the
onMessagemethod of the WebSocketGateway. -
close(
) → Future< void> -
The close method is used to close the server.
override
-
init(
ApplicationConfig config) → Future< void> -
The init method is used to initialize the server.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
send(
Uint8List message, {String? clientId}) → void -
send is used to send a binary message to the client.
The
messageparameter is the binary message to be sent. IfclientIdis provided, the message will be sent to that specific client. If not provided, the message will be broadcasted to all clients. -
sendText(
String message, {String? clientId}) → void -
sendText is used to send a text message to the client.
The
messageparameter is the text message to be sent. IfclientIdis provided, the message will be sent to that specific client. If not provided, the message will be broadcasted to all clients. -
toString(
) → String -
A string representation of this object.
inherited
-
upgrade(
IncomingMessage request, OutgoingMessage response, String clientId) → Future< void> - The upgrade method is used to upgrade the HTTP request to a WebSocket connection. It handles the WebSocket handshake and binds the client connection, disconnection, and message handler.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited