Fixed any mention of sponges being interpreted as a pong.
This commit is contained in:
parent
c2cdd55f2d
commit
8d98581cd9
|
@ -130,6 +130,8 @@ function handleError(error, socket, domain, data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pongRegex = /^pong:\d+$/;
|
||||||
|
|
||||||
async function connect(bot, games) {
|
async function connect(bot, games) {
|
||||||
const socket = {
|
const socket = {
|
||||||
ws: { readyState: 0 },
|
ws: { readyState: 0 },
|
||||||
|
@ -154,7 +156,7 @@ async function connect(bot, games) {
|
||||||
socket.ws.on('message', async (msgData) => {
|
socket.ws.on('message', async (msgData) => {
|
||||||
const msg = msgData.toString();
|
const msg = msgData.toString();
|
||||||
|
|
||||||
if (typeof msg === 'string' && msg.includes('pong')) {
|
if (typeof msg === 'string' && pongRegex.test(msg)) {
|
||||||
logger.debug(`Received pong ${msg.split(':')[1]}`);
|
logger.debug(`Received pong ${msg.split(':')[1]}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue