ActionCableLink class

Create a new Link for Graphql subscription that is backed by Rails ActionCable websocket Example:

final cableLink = ActionCableLink(
   webSocketUri,
   getAuthHeaderFunc: getAuthHeader,
);

final httpLink = HttpLink(uri);

final link = Link.split(
   (request) => request.issubscription,
   cableLink,
   httpLink,
);

final graphqlClient = GraphQLClient(
   cache: GraphQLCache(),
   link: link,
);

Constructors

Properties

action String
name of the action
final
authHeaderKey String
name of the authentication header
final
channelName String
name of the ActionCable channel
final
defaultHeaders Map<String, String>
default headers to be sent to the Rails server
final
getAuthTokenFunc GetAuthToken?
A function that returns authentication header. If not null, this method will be invoked before sending the request, Then merge with defaultHeaders to send to the server
final
hashCode int
The hash code for this object.
no setterinherited
parser → ResponseParser
final
retryDuration Duration
The duration to retry connecting to the ActionCable server in case of connection failure
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serializer → RequestSerializer
final
url String
destination url of the ActionCable server
final

Methods

concat(Link next) → Link
Adds next after this link
inherited
dispose() Future<void>
Can be called to clean up resources
inherited
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
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