From aff0720e695ece4e04e3ebefa5b7a977156bf24d Mon Sep 17 00:00:00 2001 From: Stefdv Date: Sat, 17 Sep 2016 22:56:31 +0200 Subject: [PATCH] ws error on send When sending through a ws socket you might get an error saying that the socket is not open. by adding an empty callback to `ws.send` this seems to fixe it --- gun.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gun.js b/gun.js index 618064ff..cae1e20d 100644 --- a/gun.js +++ b/gun.js @@ -1350,7 +1350,7 @@ if(res.body || res.end){ delete r.ws.cbs[req.headers['ws-rid']] } cb(err,res); } - ws.send(JSON.stringify(req)); + ws.send(JSON.stringify(req),function(err) { // that's all }) return true; } if(ws === false){ return } @@ -1474,4 +1474,4 @@ }()); if(typeof window !== "undefined"){ Gun.request = request } if(typeof module !== "undefined" && module.exports){ module.exports.request = request } -}.bind(this || module)({})); \ No newline at end of file +}.bind(this || module)({}));