nats_example

command
v0.0.0-...-c63310e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

NATS example

To run the example, first run the nats server using docker

docker run --rm -it -p 4222:4222 nats

Then, in another terminal session start the topic publisher

go run publisher.go

You can also configure how many topics the publisher should create and at what time interval every message is sent.

go run publisher.go --topics 100 --interval 1s

Then start the unifrost example server

go run main.go

Connect to the event streamer using the EventSource API in the browser or by using good old curl

curl 'localhost:3000/events?id=custom_client'

And in another terminal update the subscriptions of the client

curl -d '{"client_id": "custom_client", "add": ["topic1", "topic2"], "remove": []}' -XPOST 'localhost:3000/update_subscriptions'

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL