make sure to call next middleware

This commit is contained in:
Mark Nadal
2020-06-07 15:17:52 -07:00
parent b356877a23
commit bfb43bf7a9

View File

@@ -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);
});