@gbraver-burst-network/browser-sdk 1.15.2 → 1.15.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.
- package/lib/src/browser-sdk/index.js +2 -2
- package/lib/src/websocket/connect.js +4 -2
- package/lib/src/websocket/create-private-match-room.js +2 -1
- package/lib/src/websocket/enter-casual-match.js +2 -1
- package/lib/src/websocket/ping.js +2 -1
- package/lib/src/websocket/send-command.js +2 -1
- package/lib/src/websocket/wait-until.js +2 -1
- package/package.json +1 -1
|
@@ -144,8 +144,8 @@ class BrowserSDKImpl {
|
|
|
144
144
|
/** @override */
|
|
145
145
|
disconnectWebsocket() {
|
|
146
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
var _a;
|
|
148
|
+
(_a = __classPrivateFieldGet(this, _BrowserSDKImpl_websocket, "f")) === null || _a === void 0 ? void 0 : _a.close();
|
|
149
149
|
__classPrivateFieldSet(this, _BrowserSDKImpl_websocket, null, "f");
|
|
150
150
|
__classPrivateFieldGet(this, _BrowserSDKImpl_websocketSubscriptions, "f").forEach((v) => {
|
|
151
151
|
v.unsubscribe();
|
|
@@ -19,9 +19,11 @@ function connect(url) {
|
|
|
19
19
|
websocket.addEventListener("open", handler);
|
|
20
20
|
websocket.addEventListener("error", errorHandler);
|
|
21
21
|
}).finally(() => {
|
|
22
|
-
if (handler)
|
|
22
|
+
if (handler) {
|
|
23
23
|
websocket.removeEventListener("open", handler);
|
|
24
|
-
|
|
24
|
+
}
|
|
25
|
+
if (errorHandler) {
|
|
25
26
|
websocket.removeEventListener("error", errorHandler);
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
}
|
|
@@ -21,7 +21,8 @@ function createPrivateMatchRoom(websocket, armdozerId, pilotId) {
|
|
|
21
21
|
return (0, wait_until_1.waitUntil)(websocket, (e, resolve) => {
|
|
22
22
|
const data = (0, parse_1.parseJSON)(e.data);
|
|
23
23
|
const response = (0, created_private_match_room_1.parseCreatedPrivateMatchRoom)(data);
|
|
24
|
-
if (response)
|
|
24
|
+
if (response) {
|
|
25
25
|
resolve(response);
|
|
26
|
+
}
|
|
26
27
|
});
|
|
27
28
|
}
|
|
@@ -22,7 +22,8 @@ function enterCasualMatch(websocket, armdozerId, pilotId) {
|
|
|
22
22
|
return (0, wait_until_1.waitUntil)(websocket, (e, resolve) => {
|
|
23
23
|
const data = (0, parse_1.parseJSON)(e.data);
|
|
24
24
|
const response = (0, battle_start_1.parseBattleStart)(data);
|
|
25
|
-
if (response)
|
|
25
|
+
if (response) {
|
|
26
26
|
resolve(response);
|
|
27
|
+
}
|
|
27
28
|
});
|
|
28
29
|
}
|
|
@@ -18,7 +18,8 @@ function ping(websocket) {
|
|
|
18
18
|
return (0, wait_until_1.waitUntil)(websocket, (e, resolve) => {
|
|
19
19
|
const data = (0, parse_1.parseJSON)(e.data);
|
|
20
20
|
const response = (0, pong_1.parsePong)(data);
|
|
21
|
-
if (response)
|
|
21
|
+
if (response) {
|
|
22
22
|
resolve(response);
|
|
23
|
+
}
|
|
23
24
|
});
|
|
24
25
|
}
|
|
@@ -70,8 +70,9 @@ function sendCommandWithPolling(websocket, battleID, flowID, command) {
|
|
|
70
70
|
yield (0, wait_until_1.waitUntil)(websocket, (e, resolve) => {
|
|
71
71
|
const data = (0, parse_1.parseJSON)(e.data);
|
|
72
72
|
const acceptCommand = (0, accept_command_1.parseAcceptCommand)(data);
|
|
73
|
-
if (acceptCommand)
|
|
73
|
+
if (acceptCommand) {
|
|
74
74
|
resolve(acceptCommand);
|
|
75
|
+
}
|
|
75
76
|
});
|
|
76
77
|
const maxPollingCount = 100;
|
|
77
78
|
const pollingIntervalMilliSec = 3000;
|
package/package.json
CHANGED