WebSocketLink class
A Universal Websocket Link implementation to support the websocket transport. It supports subscriptions, query and mutation operations as well.
NOTE: the actual socket connection will only get established after a Request is handled by this WebSocketLink. If you'd like to connect to the socket server instantly, call the connectOrReconnect method after creating this WebSocketLink instance.
Constructors
- WebSocketLink.new(String url, {SocketClientConfig config = const SocketClientConfig(), String subProtocol = GraphQLProtocol.graphqlWs})
- Creates a new WebSocketLink instance with the specified config.
Properties
- config → SocketClientConfig
-
final
- getSocketClient → SocketClient?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subProtocol → String
-
final
- url → String
-
final
Methods
-
concat(
Link next) → Link -
Adds
next
after this linkinherited -
connectOrReconnect(
) → void - Connects or reconnects to the server with the specified headers.
-
dispose(
) → Future< void> -
Disposes the underlying socket client explicitly. Only use this, if you want to disconnect from
the current server in favour of another one. If that's the case, create a new WebSocketLink instance.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
request(
Request request, [NextLink? forward]) → Stream< Response> -
A function called when a request reaches this Link
override
-
route(
LinkRouter route) → Link -
Route requests after this link
inherited
-
split(
bool test(Request request), Link left, [Link right = const PassthroughLink()]) → Link -
Split requests after this link
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited