Skip to content

fossabot/nats-dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status FOSSA Status

nats-dart

NATS client to usage in Dart CLI, Web and Flutter projects

Generating documentation

Documentation is generated using the dartdoc tool

dartdoc
pub global activate dhttpd
dhttpd --path doc/api

Navigate to http://localhost:8080 and voila!! 💥

Setting up a client

Setting up a client and firing up a connection

var client = NatsClient("localhost", 4222);
await client.connect();

Note: Never use a client without waiting for the connection to establish

Publishing a message

Publishing a message can be done with or without a reply-to topic

// No reply-to topic set
client.publish("Hello world", "foo");

// If server replies to this request, send it to `bar`
client.publish("Hello world", "foo", "bar");

Subscribing to messages

To subscribe to a topic, specify the topic and optionally, a queue group

var messageStream = client.subscribe("sub-id", "foo");

// If more than one subscriber uses the same queue group,
// only one will receive the message
var messageStream = client.subscribe("sub-id", "foo", queueGroup: "group-1");

messageStream.listen((message) {
    // Do something awesome
});

Roadmap

  • Support clustering
  • Support multiple topic subscriptions

Contributions

  • No rules. Fork, change, PR.

FAQs

Can I use this in dart projects?

Not yet. The API is not yet finalised NATS protocol is not fully supported.

When will this be ready?

Soon I guess. Feel free to pitch in and it'll be ready sooner.

License

FOSSA Status

About

NATS client for Dart lang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages