Compare commits

..

No commits in common. "aeb405967b175dc267461278afa69387dd7c61f9" and "c9b985f7686ddb558c8c0be4edf7512d7019b2e6" have entirely different histories.

3 changed files with 4 additions and 26 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "schat2-clive",
"version": "1.28.1",
"version": "1.28.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "schat2-clive",
"version": "1.28.1",
"version": "1.28.0",
"license": "ISC",
"dependencies": {
"better-sqlite3": "^8.3.0",

View File

@ -1,6 +1,6 @@
{
"name": "schat2-clive",
"version": "1.28.1",
"version": "1.28.0",
"description": "Game host for SChat 2-powered chat sites",
"main": "src/app.js",
"scripts": {

View File

@ -149,14 +149,7 @@ async function connect(bot, games) {
},
});
socket.ws.on('message', async (msgData) => {
const msg = msgData.toString();
if (typeof msg === 'string' && msg.includes('pong')) {
logger.debug(`Received pong ${msg.split(':')[1]}`);
return;
}
socket.ws.on('message', async (msg) => {
const [domain, data] = JSON.parse(msg);
logger.debug(`Received ${domain}: ${JSON.stringify(data)}`);
@ -194,21 +187,6 @@ async function connect(bot, games) {
socket.ws.send(JSON.stringify([domain, data]));
};
function ping() {
setTimeout(() => {
if (socket.ws && socket.ws?.readyState === socket.ws?.OPEN) {
const now = Date.now();
socket.ws.send(`ping:${now}`);
logger.debug(`Sent ping ${now}`);
}
ping();
}, 10000);
}
ping();
socket.connect();
return socket;