Once we've faced some issues with nats
instances that connect but do not reply/fail/go down.
To avoid problems we decided to make this prototype of nats services checker.
- Application Server starts. It creates a list of instances that are connected to server.
- Client connects. Client and server exchanges messages about established connection over NATS.
- Server pings clients each second. If clients do not reply - we raise an error/process it at our server(send notification, reconnect, etc...)
- If server do not request client more that 10 seconds - client is trying to reconnect/process messages too.
npm install
node app.js
node client.js
node client2.js
- Try to stop app.js or any client. You will see behaviour