polfan-server-js-client 0.2.64 → 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.
@@ -163,7 +163,7 @@
163
163
  <workItem from="1764758258935" duration="1127000" />
164
164
  <workItem from="1764792690210" duration="1002000" />
165
165
  <workItem from="1764794428269" duration="595000" />
166
- <workItem from="1764847260499" duration="3270000" />
166
+ <workItem from="1764847260499" duration="4990000" />
167
167
  </task>
168
168
  <task id="LOCAL-00017" summary="New scheme of Bye event">
169
169
  <option name="closed" value="true" />
@@ -4314,7 +4314,7 @@ 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.isReadyToSendWsState() || this.isPendingReadyWsState())) {
4317
+ if (!(this.isOpenWsState() || this.isConnectingWsState())) {
4318
4318
  _context.n = 1;
4319
4319
  break;
4320
4320
  }
@@ -4365,7 +4365,7 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
4365
4365
  case 0:
4366
4366
  envelope = this.createEnvelope(commandType, commandData);
4367
4367
  promise = this.createPromiseFromCommandEnvelope(envelope);
4368
- if (!this.isPendingReadyWsState()) {
4368
+ if (!(this.isConnectingWsState() || !this.authenticated && this.isOpenWsState())) {
4369
4369
  _context2.n = 1;
4370
4370
  break;
4371
4371
  }
@@ -4385,17 +4385,17 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
4385
4385
  }, {
4386
4386
  key: "isReady",
4387
4387
  get: function get() {
4388
- return this.isReadyToSendWsState();
4388
+ return this.isOpenWsState() && this.authenticated;
4389
4389
  }
4390
4390
  }, {
4391
4391
  key: "sendEnvelope",
4392
4392
  value: function sendEnvelope(envelope) {
4393
4393
  var _this$ws$readyState, _this$ws2;
4394
- if (this.isReadyToSendWsState()) {
4394
+ if (this.isReady) {
4395
4395
  this.ws.send(JSON.stringify(envelope));
4396
4396
  return;
4397
4397
  }
4398
- this.handleEnvelopeSendError(envelope, new Error("Cannot send; invalid websocket 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]')));
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, ")")));
4399
4399
  }
4400
4400
  }, {
4401
4401
  key: "onMessage",
@@ -4455,14 +4455,14 @@ var WebSocketChatClient = /*#__PURE__*/function (_AbstractChatClient) {
4455
4455
  this.emit(this.Event.error, new Error('Connection timeout'));
4456
4456
  }
4457
4457
  }, {
4458
- key: "isPendingReadyWsState",
4459
- value: function isPendingReadyWsState() {
4460
- return this.ws && this.ws.readyState === this.ws.CONNECTING || !this.authenticated;
4458
+ key: "isConnectingWsState",
4459
+ value: function isConnectingWsState() {
4460
+ return this.ws && this.ws.readyState === this.ws.CONNECTING;
4461
4461
  }
4462
4462
  }, {
4463
- key: "isReadyToSendWsState",
4464
- value: function isReadyToSendWsState() {
4465
- return this.ws && this.ws.readyState === this.ws.OPEN && this.authenticated;
4463
+ key: "isOpenWsState",
4464
+ value: function isOpenWsState() {
4465
+ return this.ws && this.ws.readyState === this.ws.OPEN;
4466
4466
  }
4467
4467
  }]);
4468
4468
  }(AbstractChatClient);