Go examples and CLI clients for the NATS messaging system.
This repo contains go-gettable go-nats example client code as well as example code from the documentation.
To verify a NATS Server with either your own gnatsd or a NATS.cloud instance:
- Get and run nats-sub:
go get github.com/nats-io/go-nats-examples/tools/nats-sub nats-sub -s tls://user:password@server:port channel_name
- Get and run nats-pub:
go get github.com/nats-io/go-nats-examples/tools/nats-pub nats-pub -s tls://user:password@server:port channel_name message
- Verify publisher output:
Published [channel_name] : 'message'
- Verify subscriber output:
Listening on [channel_name] [#1] Received on [channel_name]: 'message'
The patterns directory contains a listing of example messaging patterns: