I don't think the websocket thing is gonna work.

This commit is contained in:
2025-07-04 23:55:51 +00:00
parent a64afa7e7b
commit 92f1366574

View File

@ -182,6 +182,7 @@ ws.on("close", (event: CloseEvent) => {
);
ws = reconnect(ws);
if (ws.readyState === WebSocket.OPEN) {
console.log(`Reconnection to ${process.env.PLEROMA_INSTANCE_DOMAIN} successful.`)
return;
}
reconnectAttempts++;
@ -207,13 +208,10 @@ ws.on("open", () => {
reconnectAttempts = 0;
setInterval(() => {
ws.send(JSON.stringify({ type: "ping" }));
console.log("Sending ping to keep session alive...");
// console.log("Sending ping to keep session alive...");
}, 20000);
});
ws.on("pong", (data) => {
console.log(`Pong received: ${JSON.stringify(data.toString("utf-8"))}`);
});
ws.on("message", async (data) => {
try {
@ -229,6 +227,6 @@ ws.on("message", async (data) => {
await postReplyToStatus(payload, ollamaResponse);
}
} catch (error: any) {
console.error(error.message);
throw new Error(error.message);
}
});