From bfb43bf7a919c193db5cfea0dc8b5596414fa623 Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Sun, 7 Jun 2020 15:17:52 -0700 Subject: [PATCH] make sure to call next middleware --- lib/wire.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/wire.js b/lib/wire.js index 7afae511..7094e9e7 100644 --- a/lib/wire.js +++ b/lib/wire.js @@ -64,7 +64,7 @@ Gun.on('opt', function(root){ // if we DO need an HTTP server, then choose ws specific one or GUN default one. if(!ws.noServer){ ws.server = ws.server || opt.web; - if(!ws.server){ return } + if(!ws.server){ this.to.next(root); return } // ugh, bug fix for @jamierez & unstoppable ryan. } ws.web = ws.web || new opt.WebSocket.Server(ws); // we still need a WS server. ws.web.on('connection', function(wire){ var peer; @@ -80,6 +80,5 @@ Gun.on('opt', function(root){ wire.on('error', function(e){}); setTimeout(function heart(){ if(!opt.peers[peer.id]){ return } try{ wire.send("[]") }catch(e){} ;setTimeout(heart, 1000 * 20) }, 1000 * 20); // Some systems, like Heroku, require heartbeats to not time out. // TODO: Make this configurable? // TODO: PERF: Find better approach than try/timeouts? }); - this.to.next(root); }); \ No newline at end of file