How to detect internet disconnection in Javascript for games developed in cocos creator games.

We have a default event in socket.io which is disconnect which has delay of 10seconds.
Is there any other solution or events find the disconnection immediately.