absinthe_socket 0.0.1 copy "absinthe_socket: ^0.0.1" to clipboard
absinthe_socket: ^0.0.1 copied to clipboard

outdated

A GraphQL subscription client for Absinthe sockets.

absinthe_socket #

A dart client for GraphQL subscriptions via Absinthe sockets

Getting Started #

Use the package:

# pubspec.yaml
# ...
  absinthe_socket: ^0.0.1
# ...

Create a socket, connect it, add a subscription:

    _socket = AbsintheSocket("ws://10.0.2.2:4000/socket/websocket");
    Observer _categoryObserver = Observer(
        onAbort: _onAbort,
        onCancel: _onCancel,
        onError: _onError,
        onResult: _onResult,
        onStart: _onStart);

    Notifier notifier = _socket.send(GqlRequest(
        operation:
            "subscription CategoryAdded { categoryAdded { id, title } }"));
    notifier.observe(_categoryObserver);
    // I also track notifiers to cancel them when my flutter widget is disposed of
    _notifiers.add(notifier);

This is a shameless bad rip-off of part of the API of @absinthe/socket.

3
likes
0
pub points
8%
popularity

Publisher

unverified uploader

A GraphQL subscription client for Absinthe sockets.

Homepage

License

unknown (LICENSE)

Dependencies

phoenix_wings

More

Packages that depend on absinthe_socket