stan_dart 0.0.2

Dart native
Flutter Android iOS

Dart client for NATS-Streaming, an extremely performant, lightweight reliable streaming platform built on NATS.

Bitbucket Pipelines branch Codecov Dart Version License

stan.dart #

A Dart client for NATS-Streaming, an extremely performant, lightweight reliable streaming platform built on NATS.


Note: this package is still in pre-release and not all features/functionalities are yet implemented. #

Usage #

// create a connection
var client = await Client.connectSingle(natsHost, 'myApp', username: natsUsername, password: natsPassword);

// subscribe to a topic
client.subscribe('myTopic', handler: (DataMessage message, {NatsError error}) {
  log.general.info('ooh, looky! A message for meeeeeee! ::: ${message.decodedPayload}');
});

// publish a message
await client.publish('myTopic', payload: 'this is an event on topic: myTopic')); // -- let the client encode it for us (with the default encoder (ascii))

// publish a message with a custom encoding
await client.publish('myTopic', payload: 'this is another event on topic: myTopic'), encoding: utf8); // -- specify our own encoding

// publish a message of raw bytes
var alreadyEncodedMessageBytes = ascii.encode('this is a pre-encoded event on topic: myTopic');
await client.publish('myTopic', payload: alreadyEncodedMessageBytes, encoding: null); // -- passing a null-encoding tells the client encoding has already been done

See example files for more awesomeness.


Note: this package is still in pre-release and not all features/functionalities are yet implemented. #

Contributors and PRs welcome! #

4
likes
80
pub points
0%
popularity

Dart client for NATS-Streaming, an extremely performant, lightweight reliable streaming platform built on NATS.

Homepage
Repository

Documentation

API reference

Uploader

bob.jackman@carruslearn.com

License

Apache 2.0 (LICENSE)

Dependencies

fixnum, kiwi, logging, nats_dart, protobuf, quiver, uuid

More

Packages that depend on stan_dart