However I encounter problems (at the bottom), such as the client still trying to ping the server (and fail the app) while I'm waiting for drainage to end.
I could not successfully and gracefully unsubscribe and close nats/nats-stream as a nats-streaming listener. Do you know how to make it right?
connection is closed: true
events.js:173
throw er; // Unhandled 'error' event
^
NatsError: Connection draining
at Client.publish (.../node_modules/nats/lib/nats.js:1529:32)
at Timeout.pingFun [as _onTimeout] (.../node_modules/node-nats-streaming/lib/stan.js:361:33)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
Emitted 'error' event at:
at Client.publish (.../node_modules/nats/lib/nats.js:1529:18)
at Timeout.pingFun [as _onTimeout] (.../node_modules/node-nats-streaming/lib/stan.js:361:33)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
and then immediately terminates.