centrifuge 0.1.0

  • README.md
  • Installing
  • Versions
  • 49

Build Status

Example #


  • example\flutter_app simple chat application
  • example\console simple console application

Usage #

Create client:

import 'package:centrifuge/centrifuge.dart' as centrifuge;

final client = centrifuge.createClient(url);

Connect to server:

await client.connect();

Subscribe to channel:

final subscription = client.subscribe(channel);



Subscribe to private channel:

final privateSubscription = client.subscribe(channel, token: 'token');


final output = jsonEncode({'input': message});
final data = utf8.encode(output);
await subscription.publish(data);

Checklist: #

  • [ ] connect to server using JSON protocol format
  • [x] connect to server using Protobuf protocol format
  • [x] connect with JWT
  • [ ] connect with custom header
  • [ ] support automatic reconnect in case of errors, network problems etc
  • [ ] connect and disconnect events
  • [ ] handle disconnect reason
  • [x] subscribe on channel and handle asynchronous Publications
  • [x] handle Join and Leave messages
  • [x] handle unsubscribe notifications
  • [ ] handle subscribe error
  • [ ] support publish, presence, presence stats and history methods
  • [ ] send asynchronous messages to server
  • [x] handle asynchronous messages from server
  • [ ] send RPC commands
  • [x] subscribe to private channels with JWT
  • [ ] support connection JWT refresh
  • [ ] support private channel subscription JWT refresh
  • [ ] ping/pong to find broken connection
  • [ ] support message recovery mechanism

Author #

German Saprykin, saprykin.h@gmail.com


  • Added authorization with JWT
  • Added subscription to private channel with JWT


  • Initial release

Use this package as a library

1. Depend on it

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

  centrifuge: ^0.1.0

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:centrifuge/centrifuge.dart';
Version Uploaded Documentation Archive
0.1.0 Sep 15, 2018 Go to the documentation of centrifuge 0.1.0 Download centrifuge 0.1.0 archive
0.0.1 Aug 24, 2018 Go to the documentation of centrifuge 0.0.1 Download centrifuge 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14


Detected platforms: Flutter, other

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

Health issues and suggestions

Document public APIs. (-1 points)

62 out of 62 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and centrifuge.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
meta ^1.1.5 1.1.7
protobuf ^0.9.1 0.9.1 0.13.4
Transitive dependencies
fixnum 0.10.9
Dev dependencies
mockito ^3.0.0
test ^1.3.0