absinthe_socket 0.0.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new39

absinthe_socket

A dart client for GraphQL subscriptions via Absinthe sockets

Getting Started

Use the package:

# pubspec.yaml
# ...
  absinthe_socket: ^0.0.2
# ...

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);
    // Then when the widget is disposed, I cancel the notifiers:
    _notifiers.forEach((Notifier notifier) => _socket.cancel(notifier))

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

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  absinthe_socket: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:absinthe_socket/absinthe_socket.dart';
  
Version Uploaded Documentation Archive
0.0.2 Dec 8, 2018 Go to the documentation of absinthe_socket 0.0.2 Download absinthe_socket 0.0.2 archive
0.0.1 Dec 8, 2018 Go to the documentation of absinthe_socket 0.0.1 Download absinthe_socket 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
39
Learn more about scoring.

We analyzed this package on Dec 8, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, other

Primary library: package:absinthe_socket/absinthe_socket.dart with components: io.

Health issues and suggestions

Document public APIs (-9.82 points)

55 out of 56 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use absinthe_socket.dart.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
phoenix_wings ^0.1.3 0.1.3