osjs-server icon indicating copy to clipboard operation
osjs-server copied to clipboard

server websockets fails when the application is closed.

Open mahsashadi opened this issue 2 years ago • 1 comments

Hi. In server-side of my application I am tailing a log file and sending logs via ws messages to client. When I unexpectedly close the application, It faces an error:

Error: WebSocket is not open: readyState 3 (CLOSED)

How can I make server not to send its ws messages when the app is closed?

mahsashadi avatar Sep 26 '22 15:09 mahsashadi

You can probably use ws.readyState to see if the socket is open or not.

andersevenrud avatar Sep 26 '22 17:09 andersevenrud