playsocketjs 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2243,10 +2243,7 @@ class PlaySocket {
|
|
|
2243
2243
|
break;
|
|
2244
2244
|
|
|
2245
2245
|
case 'reconnection_failed':
|
|
2246
|
-
if (this.#pendingReconnect)
|
|
2247
|
-
this.#triggerEvent("status", `Reconnection failed: ${message.reason}`);
|
|
2248
|
-
this.#pendingReconnect.reject(new Error("Reconnection failed: " + message.reason));
|
|
2249
|
-
}
|
|
2246
|
+
if (this.#pendingReconnect) this.#pendingReconnect.reject(new Error("Server rejected reconnection: " + message.reason));
|
|
2250
2247
|
break;
|
|
2251
2248
|
|
|
2252
2249
|
case 'room_created':
|
|
@@ -2230,6 +2230,14 @@ function requireServer () {
|
|
|
2230
2230
|
ws.on('pong', () => { ws.isAlive = true; });
|
|
2231
2231
|
ws.on('message', msg => this.#handleMessage(ws, msg));
|
|
2232
2232
|
ws.on('close', () => this.#handleDisconnection(ws));
|
|
2233
|
+
ws.on('error', (error) => {
|
|
2234
|
+
console.error(`PlaySocket WebSocket connection error for client ${ws.clientId || 'unknown'}:`, error); // Catch conn errors
|
|
2235
|
+
});
|
|
2236
|
+
});
|
|
2237
|
+
|
|
2238
|
+
// Log & catch server-level errors
|
|
2239
|
+
this.#wss.on('error', (error) => {
|
|
2240
|
+
console.error('PlaySocket WebSocket server error:', error);
|
|
2233
2241
|
});
|
|
2234
2242
|
|
|
2235
2243
|
// Start heartbeat
|