diff --git a/client.js b/client.js index 86f2cbb..6187a5a 100755 --- a/client.js +++ b/client.js @@ -309,6 +309,12 @@ async function handshake(name, password){ ws.once("open", function(){ deek.emit("login"); + + ws._socket.setTimeout(10000); + ws._socket.on("timeout", function(){ + + deek.emit("error", "timed out") + }); }); ws.once("close", function(){ @@ -409,12 +415,6 @@ async function handshake(name, password){ deek.emit("error", "code=" + code + " reason=" + reason); }); - - ws._socket.setTimeout(10000); - ws._socket.on("timeout", function(){ - - deek.emit("error", "timed out") - }); } /*