Dart library to interact with Absinthe Subscriptions over Phoenix Channels.
This library uses phoenix_socket for Phoenix Channel, making the API consistent across web and native environments.
This is a simple implementation.
Link createGraphqlLink() async {
final HttpLink httpLink = HttpLink("http://localhost/graphql");
final phoenixSocket = PhoenixSocket(
"ws://localhost/graphql/websocket",
socketOptions: PhoenixSocketOptions(
params: {"authorization": 'My Strong Token'},
),
);
final wsLink = AbsintheSocketLink(phoenixSocket);
return Link.split(
(request) => request.isSubscription,
wsLink, httpLink,
);
}