Skip to content

Commit

Permalink
fix: repaired my solo breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Aug 23, 2021
1 parent 9b24a39 commit 5b0ccc3
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/solo/src/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,14 @@ export async function makeHTTPListener(basedir, port, host, rawInboundCommand) {

server.listen(port, host, () => log.info('Listening on', `${host}:${port}`));

const wsActions = {
noop() {
// do nothing.
},
heartbeat() {
wsActions.isAlive = true;
},
};

const pingInterval = setInterval(function ping() {
wss.clients.forEach(ws => {
if (!ws.isAlive) {
ws.terminate();
return;
}
ws.isAlive = false;
ws.ping(wsActions.noop);
ws.ping(() => {});
});
}, 30000);

Expand All @@ -242,7 +233,9 @@ export async function makeHTTPListener(basedir, port, host, rawInboundCommand) {

// Manage connection pings.
ws.isAlive = true;
ws.on('pong', wsActions.heartbeat);
ws.on('pong', () => {
ws.isAlive = true;
});

// Register the point-to-point channel.
channels.set(channelID, ws);
Expand Down

0 comments on commit 5b0ccc3

Please sign in to comment.