Skip to content

Latest commit

 

History

History
80 lines (52 loc) · 1.54 KB

README.md

File metadata and controls

80 lines (52 loc) · 1.54 KB

Classic Nats, Jetstream and Websocket

Design: https://github.com/appscode/nats-design

Classic NATS Server

  • Run nats-account-server

    $ ./nats-account-server -c account-server.conf &
  • Now checkout to <project-directory>/nats-v2 directory.

    $ cd nats-v2
  • All necessary accounts are already created. Even then you want to create again, run ( Optional ):

    $ go run accounts/main.go
  • Now start the Classic Nats server

    $ go run server/main.go &
  • Start a subscriber to Classic Nats which will receive all the events sent to *.Events. This program redirects all the incoming events to the jetstream server Stream named ReceivedEvents.

    $ go run sub/main.go




Jetstream Server

  • Checkout to the <project-directory>/nats directory

    $ cd nats
  • All necessary accounts are already created. Even then you want to create again, run ( Optional ):

    $ go run accounts/main.go
  • Start the Jetstream server

    $ go run server/main.go &
  • Start the receiver which checks all the events sent to the stream and after processing the events it sends them to the user's Notifications channel.

    $ go run receiver/main.go




Websocket

  • Checkout to the <project-directory>/nats.ws directory

    $ cd nats.ws
  • Serve the html file

    $ npm install http-server -g
    $ http-server -o