Mohsen Shakiba
Mohsen Shakiba

Reputation: 1872

Node.js - socket close event not fired when user internet is lost

I'm writing a chat application with Node.js and ws
there is a on close event which is fired when user gracefully disconnects but when the internet is lost, this event is not fired.
is there anyway we can detect when user has lost the connection?

Upvotes: 1

Views: 203

Answers (1)

onehalf
onehalf

Reputation: 2742

Best way is to handle own ping/pong methods. It's usable also for measure connection latency.

Upvotes: 1

Related Questions