@alpha-arcade/sdk 0.4.0 → 0.4.1
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.
- package/README.md +22 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3424,7 +3424,7 @@ var AlphaWebSocket = class {
|
|
|
3424
3424
|
}
|
|
3425
3425
|
/** Query a server property (e.g. "heartbeat", "limits") */
|
|
3426
3426
|
getProperty(property) {
|
|
3427
|
-
return this.sendRequest({ method: "GET_PROPERTY", property });
|
|
3427
|
+
return this.sendRequest({ method: "GET_PROPERTY", params: [property] });
|
|
3428
3428
|
}
|
|
3429
3429
|
// ============================================
|
|
3430
3430
|
// Lifecycle
|
|
@@ -3524,9 +3524,10 @@ var AlphaWebSocket = class {
|
|
|
3524
3524
|
this.send({ method: "PONG" });
|
|
3525
3525
|
return;
|
|
3526
3526
|
}
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
this.pendingRequests.
|
|
3527
|
+
const responseId = typeof msg.id === "string" ? msg.id : typeof msg.requestId === "string" ? msg.requestId : null;
|
|
3528
|
+
if (responseId && this.pendingRequests.has(responseId)) {
|
|
3529
|
+
const req = this.pendingRequests.get(responseId);
|
|
3530
|
+
this.pendingRequests.delete(responseId);
|
|
3530
3531
|
clearTimeout(req.timer);
|
|
3531
3532
|
req.resolve(msg);
|
|
3532
3533
|
return;
|
|
@@ -3543,10 +3544,10 @@ var AlphaWebSocket = class {
|
|
|
3543
3544
|
}
|
|
3544
3545
|
}
|
|
3545
3546
|
sendSubscribe(stream, params) {
|
|
3546
|
-
this.send({ method: "SUBSCRIBE", stream, ...params });
|
|
3547
|
+
this.send({ method: "SUBSCRIBE", params: [{ stream, ...params }] });
|
|
3547
3548
|
}
|
|
3548
3549
|
sendUnsubscribe(stream, params) {
|
|
3549
|
-
this.send({ method: "UNSUBSCRIBE", stream, ...params });
|
|
3550
|
+
this.send({ method: "UNSUBSCRIBE", params: [{ stream, ...params }] });
|
|
3550
3551
|
}
|
|
3551
3552
|
sendRequest(payload, timeoutMs = 1e4) {
|
|
3552
3553
|
const requestId = crypto.randomUUID();
|
|
@@ -3558,10 +3559,10 @@ var AlphaWebSocket = class {
|
|
|
3558
3559
|
this.pendingRequests.set(requestId, { resolve, reject, timer });
|
|
3559
3560
|
if (!this.connected) {
|
|
3560
3561
|
this.connect().then(() => {
|
|
3561
|
-
this.send({ ...payload, requestId });
|
|
3562
|
+
this.send({ ...payload, id: requestId });
|
|
3562
3563
|
}).catch(reject);
|
|
3563
3564
|
} else {
|
|
3564
|
-
this.send({ ...payload, requestId });
|
|
3565
|
+
this.send({ ...payload, id: requestId });
|
|
3565
3566
|
}
|
|
3566
3567
|
});
|
|
3567
3568
|
}
|
|
@@ -3576,7 +3577,7 @@ var AlphaWebSocket = class {
|
|
|
3576
3577
|
startHeartbeat() {
|
|
3577
3578
|
this.stopHeartbeat();
|
|
3578
3579
|
this.heartbeatTimer = setInterval(() => {
|
|
3579
|
-
this.send({
|
|
3580
|
+
this.send({ method: "PING" });
|
|
3580
3581
|
}, this.heartbeatIntervalMs);
|
|
3581
3582
|
}
|
|
3582
3583
|
stopHeartbeat() {
|