Skip to content

Commit 15e3ce3

Browse files
committed
invert waitingForPong logic
1 parent 2aa616c commit 15e3ce3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/LiveQuery/ParseWebSocketServer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export class ParseWebSocketServer {
1414
logger.info('Parse LiveQuery Server started running');
1515
};
1616
wss.onConnection = ws => {
17-
ws.waitingForPong = true;
17+
ws.waitingForPong = false;
1818
ws.on('pong', () => {
19-
this.waitingForPong = true;
19+
this.waitingForPong = false;
2020
});
2121
ws.on('error', error => {
2222
logger.error(error.message);
@@ -25,9 +25,9 @@ export class ParseWebSocketServer {
2525
onConnect(new ParseWebSocket(ws));
2626
// Send ping to client periodically
2727
const pingIntervalId = setInterval(() => {
28-
if (ws.waitingForPong) {
28+
if (!ws.waitingForPong) {
2929
ws.ping();
30-
ws.waitingForPong = false;
30+
ws.waitingForPong = true;
3131
} else {
3232
clearInterval(pingIntervalId);
3333
ws.terminate();

0 commit comments

Comments
 (0)