polfan-server-js-client 0.2.63 → 0.2.65
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/.idea/workspace.xml
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
7
|
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Align to custom colors and nicks protocol changes">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js.map" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/build/index.umd.js" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.umd.js" afterDir="false" />
|
|
11
|
+
<change beforePath="$PROJECT_DIR$/build/index.umd.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.umd.js.map" afterDir="false" />
|
|
12
|
+
<change beforePath="$PROJECT_DIR$/build/types/WebSocketChatClient.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/WebSocketChatClient.d.ts" afterDir="false" />
|
|
8
13
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
9
14
|
<change beforePath="$PROJECT_DIR$/src/WebSocketChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/WebSocketChatClient.ts" afterDir="false" />
|
|
10
15
|
</list>
|
|
@@ -156,7 +161,9 @@
|
|
|
156
161
|
<workItem from="1764689604655" duration="307000" />
|
|
157
162
|
<workItem from="1764716454990" duration="1338000" />
|
|
158
163
|
<workItem from="1764758258935" duration="1127000" />
|
|
159
|
-
<workItem from="1764792690210" duration="
|
|
164
|
+
<workItem from="1764792690210" duration="1002000" />
|
|
165
|
+
<workItem from="1764794428269" duration="595000" />
|
|
166
|
+
<workItem from="1764847260499" duration="4990000" />
|
|
160
167
|
</task>
|
|
161
168
|
<task id="LOCAL-00017" summary="New scheme of Bye event">
|
|
162
169
|
<option name="closed" value="true" />
|
package/build/index.cjs.js
CHANGED
|
@@ -4314,6 +4314,12 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
4314
4314
|
return WebSocketChatClient_regenerator().w(function (_context) {
|
|
4315
4315
|
while (1) switch (_context.n) {
|
|
4316
4316
|
case 0:
|
|
4317
|
+
if (!(this.isOpenWsState() || this.isConnectingWsState())) {
|
|
4318
|
+
_context.n = 1;
|
|
4319
|
+
break;
|
|
4320
|
+
}
|
|
4321
|
+
return _context.a(2);
|
|
4322
|
+
case 1:
|
|
4317
4323
|
params = new URLSearchParams((_this$options$queryPa = this.options.queryParams) !== null && _this$options$queryPa !== void 0 ? _this$options$queryPa : {});
|
|
4318
4324
|
params.set('token', this.options.token);
|
|
4319
4325
|
this.ws = new WebSocket("".concat(this.options.url, "?").concat(params));
|
|
@@ -4359,7 +4365,7 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
4359
4365
|
case 0:
|
|
4360
4366
|
envelope = this.createEnvelope(commandType, commandData);
|
|
4361
4367
|
promise = this.createPromiseFromCommandEnvelope(envelope);
|
|
4362
|
-
if (!this.
|
|
4368
|
+
if (!(this.isConnectingWsState() || !this.authenticated && this.isOpenWsState())) {
|
|
4363
4369
|
_context2.n = 1;
|
|
4364
4370
|
break;
|
|
4365
4371
|
}
|
|
@@ -4379,17 +4385,17 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
4379
4385
|
}, {
|
|
4380
4386
|
key: "isReady",
|
|
4381
4387
|
get: function get() {
|
|
4382
|
-
return this.
|
|
4388
|
+
return this.isOpenWsState() && this.authenticated;
|
|
4383
4389
|
}
|
|
4384
4390
|
}, {
|
|
4385
4391
|
key: "sendEnvelope",
|
|
4386
4392
|
value: function sendEnvelope(envelope) {
|
|
4387
4393
|
var _this$ws$readyState, _this$ws2;
|
|
4388
|
-
if (this.
|
|
4394
|
+
if (this.isReady) {
|
|
4389
4395
|
this.ws.send(JSON.stringify(envelope));
|
|
4390
4396
|
return;
|
|
4391
4397
|
}
|
|
4392
|
-
this.handleEnvelopeSendError(envelope, new Error("Cannot send
|
|
4398
|
+
this.handleEnvelopeSendError(envelope, new Error("Cannot send - client is not ready (state=".concat((_this$ws$readyState = (_this$ws2 = this.ws) === null || _this$ws2 === void 0 ? void 0 : _this$ws2.readyState) !== null && _this$ws$readyState !== void 0 ? _this$ws$readyState : '[no connection]', "; authenticated=").concat(this.authenticated, ")")));
|
|
4393
4399
|
}
|
|
4394
4400
|
}, {
|
|
4395
4401
|
key: "onMessage",
|
|
@@ -4449,14 +4455,14 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
|
|
|
4449
4455
|
this.emit(this.Event.error, new Error('Connection timeout'));
|
|
4450
4456
|
}
|
|
4451
4457
|
}, {
|
|
4452
|
-
key: "
|
|
4453
|
-
value: function
|
|
4454
|
-
return this.ws && this.ws.readyState === this.ws.CONNECTING
|
|
4458
|
+
key: "isConnectingWsState",
|
|
4459
|
+
value: function isConnectingWsState() {
|
|
4460
|
+
return this.ws && this.ws.readyState === this.ws.CONNECTING;
|
|
4455
4461
|
}
|
|
4456
4462
|
}, {
|
|
4457
|
-
key: "
|
|
4458
|
-
value: function
|
|
4459
|
-
return this.ws && this.ws.readyState === this.ws.OPEN
|
|
4463
|
+
key: "isOpenWsState",
|
|
4464
|
+
value: function isOpenWsState() {
|
|
4465
|
+
return this.ws && this.ws.readyState === this.ws.OPEN;
|
|
4460
4466
|
}
|
|
4461
4467
|
}]);
|
|
4462
4468
|
}(AbstractChatClient);
|