playsocketjs 1.1.2 → 1.1.3
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.
|
@@ -2377,9 +2377,9 @@ class PlaySocket {
|
|
|
2377
2377
|
async #requestStateSync() {
|
|
2378
2378
|
if (this.#pendingStateRequest) return; // Return if already requested
|
|
2379
2379
|
try {
|
|
2380
|
-
Promise.race([
|
|
2381
|
-
new Promise(async (resolve) => {
|
|
2382
|
-
this.#pendingStateRequest = { resolve };
|
|
2380
|
+
await Promise.race([
|
|
2381
|
+
new Promise(async (resolve, reject) => {
|
|
2382
|
+
this.#pendingStateRequest = { resolve, reject };
|
|
2383
2383
|
this.#sendToServer({ type: 'request_state' });
|
|
2384
2384
|
}),
|
|
2385
2385
|
this.#createTimeout("State request")
|
|
@@ -2411,7 +2411,7 @@ class PlaySocket {
|
|
|
2411
2411
|
*/
|
|
2412
2412
|
#sendToServer(data) {
|
|
2413
2413
|
if (!this.#socket || this.#socket.readyState !== WebSocket.OPEN) {
|
|
2414
|
-
return console.
|
|
2414
|
+
return console.warn(WARNING_PREFIX + "Cannot send message - not connected.");
|
|
2415
2415
|
}
|
|
2416
2416
|
try {
|
|
2417
2417
|
this.#socket.send(encode(data));
|