In the ws Node.js WebSocket library, regarding the event socket.on('close', ...)
, is there any direct way (i. e. by inspecting the event) to determine if the client has closed the socket OR the server closed it for this client?
Even when the server explicitly sets a specific close code (4001), the handler on the server side for the close event gets a generic close code (1005).
So there is no way around but to remember it somewhere if the server closed the socket?
If the client closed it, it knows it closed it. But if it doesn't then it must be server. The same thing can happen server-side
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With