centrifuge 0.1.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new53

Build Status

Example

Examples:

  • 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);

subscription.publishStream.listen(onEvent);
subscription.joinStream.listen(onEvent);
subscription.leaveStream.listen(onEvent);

subscription.subscribeSuccessStream.listen(onEvent);
subscription.subscribeErrorStream.listen(onEvent);
subscription.unsubscribeStream.listen(onEvent);

Subscribe to private channel:

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

Publish:

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

[0.1.0]

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

[0.0.1]

  • Initial release

Use this package as a library

1. Depend on it

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


dependencies:
  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
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.3

Platforms

Detected platforms: Flutter, other

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

Suggestions

Fix lib/src/proto/client.pb.dart.

Analysis of lib/src/proto/client.pb.dart reported 2 hints:

line 1200 col 7: Name types using UpperCamelCase.

line 1250 col 7: Name types using UpperCamelCase.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use centrifuge.dart.

Dependencies

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