aboutsummaryrefslogtreecommitdiff
path: root/websockets
diff options
context:
space:
mode:
Diffstat (limited to 'websockets')
-rwxr-xr-xwebsockets/server.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/websockets/server.js b/websockets/server.js
index 86307e6..b650ce1 100755
--- a/websockets/server.js
+++ b/websockets/server.js
@@ -63,6 +63,9 @@ wsServer=wsServer.ws("/*",{
linebuf=linebuf.slice(idx+1);
}
});
+ stateobj.netconn.on("error",()=>{
+ if(!stateobj.sock_closed)sock.close();
+ });
},
message: (sock,data,isBinary)=>{
const stateobj=sock["tomsgdata"];
@@ -77,7 +80,8 @@ wsServer=wsServer.ws("/*",{
close: sock=>{
const stateobj=sock["tomsgdata"];
stateobj.sock_closed=true;
- stateobj.netconn.end();
+ try {stateobj.netconn.end();}
+ catch (e) {}
}
});