@telegenta/webclient 2.0.10 → 2.0.12

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.
Files changed (54) hide show
  1. package/README.md +0 -0
  2. package/babel.config.js +0 -0
  3. package/browser/telegenta.min.js +1 -1
  4. package/demos/add_phone_number.html +0 -0
  5. package/demos/calldata_available.html +0 -0
  6. package/demos/embedded_config.html +94 -94
  7. package/demos/event_client.html +225 -225
  8. package/demos/phone_client.html +557 -557
  9. package/demos/styles.css +0 -0
  10. package/demos/telegenta.min.js +1 -0
  11. package/docs/EventClient.html +1 -1
  12. package/docs/Phone.html +1 -1
  13. package/docs/Session.html +1 -1
  14. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  15. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -0
  16. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  17. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  18. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -0
  19. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  20. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  21. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -0
  22. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  23. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  24. package/docs/fonts/OpenSans-Light-webfont.svg +0 -0
  25. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  26. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  27. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -0
  28. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  29. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  30. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -0
  31. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  32. package/docs/global.html +1 -1
  33. package/docs/index.html +1 -1
  34. package/docs/scripts/linenumber.js +0 -0
  35. package/docs/scripts/prettify/Apache-License-2.0.txt +0 -0
  36. package/docs/scripts/prettify/lang-css.js +0 -0
  37. package/docs/scripts/prettify/prettify.js +0 -0
  38. package/docs/styles/jsdoc-default.css +0 -0
  39. package/docs/styles/prettify-jsdoc.css +0 -0
  40. package/docs/styles/prettify-tomorrow.css +0 -0
  41. package/embedded_client/embedded_phone.js +0 -0
  42. package/embedded_client/index.html +0 -0
  43. package/embedded_client/server.php +0 -0
  44. package/embedded_client/styles.css +0 -0
  45. package/embedded_client/tiny_rest_client.php +0 -0
  46. package/embedded_client/webphone_sprites.png +0 -0
  47. package/es5/event-client.js +175 -219
  48. package/es5/index.js +0 -0
  49. package/es5/phone-client.js +771 -1173
  50. package/package.json +1 -1
  51. package/src/event-client.js +1 -1
  52. package/src/index.js +0 -0
  53. package/src/phone-client.js +1 -1
  54. package/webpack.config.js +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
@@ -7,313 +7,269 @@ exports.EventClient = void 0;
7
7
 
8
8
  var _common = require("@telegenta/common");
9
9
 
10
- var _0x3970 = ['\x20payload:\x20', 'payload', 'Callback\x20had\x20unhandled\x20exception\x20', 'resolve', 'reject', 'Invalid\x20subscription\x20id\x20for\x20event:\x20', 'wss://api.telegenta.com/es/', 'random', 'specification', 'callback', 'doCallback', 'apply', '_socket', '_previousSubscriptions', '_activeSubscriptions', '_autoReconnect', '_reconnectRetrySeconds', 'log', 'LogHandler', 'LOGLVL', '_requestor', 'event', '_serverAddress', '_connectServer', 'disconnect', 'readyState', 'NoActiveSession', 'close', 'isConnected', 'subscribe', 'You\x20must\x20specify\x20both\x20event\x20spec\x20and\x20callback\x20function', 'hasOwnProperty', 'event_name', 'InvalidParameter', 'Your\x20event\x20specification\x20must\x20contain\x20event\x20name', 'Subscription\x20to\x20\x27', 'push', 'warning', '\x27\x20failed:\x20', 'unsubscribe', 'You\x20must\x20specify\x20subscription\x20id', 'info', 'Unsubscribe\x20id:\x20', 'sendRequest', 'then', 'Unsubscribe\x20to\x20\x27', '\x27\x20was\x20successful', 'Remote\x20unsubscribe\x20to\x20\x27', 'fireEvent', 'Event\x20', '\x20failed:\x20', '_removeSubscription', 'debug', 'splice', '\x20locally,\x20not\x20found?', 'Connecting\x20to\x20event\x20server:\x20', 'Unable\x20to\x20connect,\x20already\x20connected', 'Unable\x20to\x20connect,\x20socket\x20is\x20still\x20closing', 'addEventListener', 'message', 'receiveMessage', 'data', '_pingTimerObj', 'Ping\x20failed:\x20', '_reconnectServer', 'catch', 'error', 'Resubscribing\x20to\x20', 'Disconnected\x20from\x20event\x20service', 'Websocket\x20connection\x20error', 'Unable\x20to\x20connect:\x20', 'floor', 'Reconnecting\x20in\x20', '\x20secs', 'Reconnect\x20attempt\x20successful', 'Reconnect\x20attempt\x20failed', 'subscription_id', 'Received\x20event\x20for\x20subcription\x20id\x20'];
11
-
12
- (function (_0x4cdfa8, _0x5bcf47) {
13
- var _0x1ec0a5 = function _0x1ec0a5(_0x34ade6) {
14
- while (--_0x34ade6) {
15
- _0x4cdfa8['push'](_0x4cdfa8['shift']());
16
- }
17
- };
18
-
19
- _0x1ec0a5(++_0x5bcf47);
20
- })(_0x3970, 0xf0);
10
+ const a0_0x3a92ef = a0_0x488e;
21
11
 
22
- var _0xd3f1 = function _0xd3f1(_0x581502, _0x5594da) {
23
- _0x581502 = _0x581502 - 0x0;
24
- var _0x54037e = _0x3970[_0x581502];
25
- return _0x54037e;
26
- };
12
+ (function (_0x12d3b3, _0x32fdfc) {
13
+ const _0x5a3514 = a0_0x488e,
14
+ _0x3c9baf = _0x12d3b3();
27
15
 
28
- 'use strict';
16
+ while (!![]) {
17
+ try {
18
+ const _0x43507d = -parseInt(_0x5a3514(0x1b0)) / 0x1 * (parseInt(_0x5a3514(0x179)) / 0x2) + parseInt(_0x5a3514(0x1c9)) / 0x3 + -parseInt(_0x5a3514(0x1c7)) / 0x4 * (-parseInt(_0x5a3514(0x1a4)) / 0x5) + -parseInt(_0x5a3514(0x199)) / 0x6 + -parseInt(_0x5a3514(0x1c1)) / 0x7 * (-parseInt(_0x5a3514(0x1c6)) / 0x8) + parseInt(_0x5a3514(0x195)) / 0x9 + parseInt(_0x5a3514(0x1c8)) / 0xa * (parseInt(_0x5a3514(0x1a5)) / 0xb);
29
19
 
30
- const PING_INTERVAL = 0x32;
20
+ if (_0x43507d === _0x32fdfc) break;else _0x3c9baf['push'](_0x3c9baf['shift']());
21
+ } catch (_0x2f5b4c) {
22
+ _0x3c9baf['push'](_0x3c9baf['shift']());
23
+ }
24
+ }
25
+ })(a0_0x4c0a, 0xe39ca);
31
26
 
32
- const ES_DEFAULT_SERVER_URL = _0xd3f1('0x0');
27
+ function a0_0x488e(_0x47c6e3, _0x5aa6aa) {
28
+ const _0x4c0a77 = a0_0x4c0a();
33
29
 
34
- const RETRY_INTERVAL_START = 0x1 + Math[_0xd3f1('0x1')]();
30
+ return a0_0x488e = function a0_0x488e(_0x488e02, _0x3106bd) {
31
+ _0x488e02 = _0x488e02 - 0x177;
32
+ let _0x3b5d7b = _0x4c0a77[_0x488e02];
33
+ return _0x3b5d7b;
34
+ }, a0_0x488e(_0x47c6e3, _0x5aa6aa);
35
+ }
35
36
 
36
- const RETRY_MAX_BACKOFF = 0x12c;
37
+ const PING_INTERVAL = 0x32,
38
+ ES_DEFAULT_SERVER_URL = a0_0x3a92ef(0x196),
39
+ RETRY_INTERVAL_START = 0x1 + Math[a0_0x3a92ef(0x188)](),
40
+ RETRY_MAX_BACKOFF = 0x12c;
37
41
 
38
42
  class EventSubscription {
39
- constructor(_0x3e187f, _0x5d82b1, _0x329ea3) {
40
- this['id'] = _0x3e187f;
41
- this[_0xd3f1('0x2')] = _0x5d82b1;
42
- this[_0xd3f1('0x3')] = _0x329ea3;
43
+ constructor(_0x4fba20, _0x7c38f5, _0x59affb) {
44
+ const _0xf29903 = a0_0x3a92ef;
45
+ this['id'] = _0x4fba20, this[_0xf29903(0x19b)] = _0x7c38f5, this[_0xf29903(0x17c)] = _0x59affb;
43
46
  }
44
47
 
45
- [_0xd3f1('0x4')](_0x19969f, _0x5f2b7c) {
46
- return this[_0xd3f1('0x3')][_0xd3f1('0x5')](_0x19969f, [_0x5f2b7c]);
48
+ [a0_0x3a92ef(0x186)](_0x53b5b2, _0x509ac7) {
49
+ const _0x44d374 = a0_0x3a92ef;
50
+ return this[_0x44d374(0x17c)][_0x44d374(0x1b3)](_0x53b5b2, [_0x509ac7]);
47
51
  }
48
52
 
49
53
  }
50
54
 
55
+ function a0_0x4c0a() {
56
+ const _0x485ce7 = ['resolve', 'Remote\x20unsubscribe\x20to\x20\x27', 'Invalid\x20subscription\x20id\x20for\x20event:\x20', 'ping', 'close', '_connectServer', 'warning', 'Unsubscribe\x20id:\x20', 'info', 'error', '1lZHOWt', '\x27\x20was\x20successful,\x20ID\x20=\x20', '\x27\x20failed:\x20', 'apply', '\x20payload:\x20', '_serverAddress', 'Received\x20event\x20for\x20subcription\x20id\x20', 'Connecting\x20to\x20event\x20server:\x20', '\x20failed:\x20', 'Your\x20event\x20specification\x20must\x20contain\x20event\x20name', '_reconnectRetrySeconds', 'floor', '_removeSubscription', '_previousSubscriptions', 'Auto\x20reconnect\x20disabled\x20(disconnecting?)', 'Unable\x20to\x20connect,\x20already\x20connected', 'ERROR', '56OrigyO', '_pingTimerObj', '_reconnectServer', 'connect', 'unsubscribe', '662456BZpuJo', '6008DSHkUD', '18990UxdhWi', '464130plrEsI', 'data', 'subscribe', 'splice', 'Subscription\x20to\x20\x27', 'hasOwnProperty', 'log', 'Unsubscribe\x20to\x20\x27', '1725680DTpKOJ', 'Unable\x20to\x20connect,\x20already\x20connecting', 'open', 'callback', 'catch', 'event_name', '_activeSubscriptions', 'reject', 'readyState', 'Disconnected\x20from\x20event\x20service', 'Unable\x20to\x20remove\x20subscription\x20', 'sendRequest', '_socket', 'doCallback', 'stringify', 'random', 'InvalidParameter', 'isConnected', 'Callback\x20had\x20unhandled\x20exception\x20', 'Successfully\x20connected\x20to\x20event\x20service', 'addEventListener', 'then', 'NoActiveSession', 'event', 'receiveMessage', 'Unable\x20to\x20connect,\x20socket\x20is\x20still\x20closing', 'Reconnecting\x20in\x20', 'Resubscribing\x20to\x20', '5429817MaKzsW', 'wss://api.telegenta.com/es/', 'LogHandler', '_autoReconnect', '8159778JjsSOL', 'Reconnect\x20attempt\x20successful', 'specification', 'You\x20must\x20specify\x20subscription\x20id', 'Event\x20', '_requestor', 'payload', 'debug', 'Websocket\x20connection\x20error', 'push', 'You\x20must\x20specify\x20both\x20event\x20spec\x20and\x20callback\x20function', '1855QvgqTM', '6820qcAMGe'];
57
+
58
+ a0_0x4c0a = function a0_0x4c0a() {
59
+ return _0x485ce7;
60
+ };
61
+
62
+ return a0_0x4c0a();
63
+ }
64
+
51
65
  class EventClient {
52
66
  constructor() {
53
- let _0x3f07c5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
54
-
55
- this[_0xd3f1('0x6')] = null;
56
- this[_0xd3f1('0x7')] = [];
57
- this[_0xd3f1('0x8')] = [];
58
- this['_pingTimerObj'] = null;
59
- this[_0xd3f1('0x9')] = ![];
60
- this[_0xd3f1('0xa')] = RETRY_INTERVAL_START;
61
- this[_0xd3f1('0xb')] = _0x3f07c5 ? _0x3f07c5 : new _common.Logger[_0xd3f1('0xc')](_common.Logger[_0xd3f1('0xd')]['ERROR']);
62
- this[_0xd3f1('0xe')] = new _common.Requestor(this[_0xd3f1('0xb')]);
63
- this['_requestor']['on'](_0xd3f1('0xf'), _0x16c22c => {
64
- this['_handleIncomingEvent'](_0x16c22c);
67
+ let _0x1844da = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
68
+
69
+ const _0x1e3a95 = a0_0x3a92ef;
70
+ this[_0x1e3a95(0x185)] = null, this[_0x1e3a95(0x1bd)] = [], this[_0x1e3a95(0x17f)] = [], this[_0x1e3a95(0x1c2)] = null, this['_autoReconnect'] = ![], this[_0x1e3a95(0x1ba)] = RETRY_INTERVAL_START, this[_0x1e3a95(0x177)] = _0x1844da ? _0x1844da : new _common.Logger[_0x1e3a95(0x197)](_common.Logger['LOGLVL'][_0x1e3a95(0x1c0)]), this[_0x1e3a95(0x19e)] = new _common.Requestor(this[_0x1e3a95(0x177)]), this[_0x1e3a95(0x19e)]['on'](_0x1e3a95(0x190), _0x1f294f => {
71
+ this['_handleIncomingEvent'](_0x1f294f);
65
72
  });
66
73
  }
67
74
 
68
- ['connect']() {
69
- let _0x2b27d1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
75
+ [a0_0x3a92ef(0x1c4)]() {
76
+ let _0x38cd76 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
70
77
 
71
- if (!_0x2b27d1) {
72
- _0x2b27d1 = ES_DEFAULT_SERVER_URL;
73
- }
74
-
75
- this[_0xd3f1('0x10')] = _0x2b27d1;
76
- this[_0xd3f1('0x7')] = [];
77
- this[_0xd3f1('0x8')] = [];
78
- return this[_0xd3f1('0x11')]();
78
+ const _0x427f96 = a0_0x3a92ef;
79
+ return !_0x38cd76 && (_0x38cd76 = ES_DEFAULT_SERVER_URL), this['_serverAddress'] = _0x38cd76, this[_0x427f96(0x1bd)] = [], this[_0x427f96(0x17f)] = [], this[_0x427f96(0x1ab)]();
79
80
  }
80
81
 
81
- [_0xd3f1('0x12')]() {
82
- if (this[_0xd3f1('0x6')][_0xd3f1('0x13')] !== 0x1) {
83
- throw new _common.Exceptions[_0xd3f1('0x14')]();
84
- }
85
-
86
- this[_0xd3f1('0x8')] = [];
87
- this[_0xd3f1('0x9')] = ![];
88
-
89
- this[_0xd3f1('0x6')][_0xd3f1('0x15')]();
82
+ ['disconnect']() {
83
+ const _0x2d8b68 = a0_0x3a92ef;
84
+ if (this[_0x2d8b68(0x185)]['readyState'] !== 0x1) throw new _common.Exceptions[_0x2d8b68(0x18f)]();
85
+ this[_0x2d8b68(0x17f)] = [], this['_autoReconnect'] = ![], this[_0x2d8b68(0x185)][_0x2d8b68(0x1aa)]();
90
86
  }
91
87
 
92
- [_0xd3f1('0x16')]() {
93
- if (this[_0xd3f1('0x6')]) {
94
- return this['_socket'][_0xd3f1('0x13')] === 0x1;
95
- } else {
96
- return ![];
97
- }
88
+ [a0_0x3a92ef(0x18a)]() {
89
+ const _0x5d06a4 = a0_0x3a92ef;
90
+ return this['_socket'] ? this[_0x5d06a4(0x185)]['readyState'] === 0x1 : ![];
98
91
  }
99
92
 
100
- [_0xd3f1('0x17')](_0x43b4b8, _0xd67385) {
101
- if (!_0x43b4b8 || !_0xd67385) {
102
- throw new _common.Exceptions['InvalidParameter'](_0xd3f1('0x18'));
103
- }
104
-
105
- if (!_0x43b4b8[_0xd3f1('0x19')](_0xd3f1('0x1a'))) {
106
- throw new _common.Exceptions[_0xd3f1('0x1b')](_0xd3f1('0x1c'));
107
- }
108
-
109
- if (!this[_0xd3f1('0x16')]()) {
110
- throw new _common.Exceptions[_0xd3f1('0x14')]();
111
- }
93
+ [a0_0x3a92ef(0x1cb)](_0x359a76, _0x56d21a) {
94
+ const _0x56507c = a0_0x3a92ef;
95
+ if (!_0x359a76 || !_0x56d21a) throw new _common.Exceptions['InvalidParameter'](_0x56507c(0x1a3));
96
+ if (!_0x359a76[_0x56507c(0x1ce)](_0x56507c(0x17e))) throw new _common.Exceptions['InvalidParameter'](_0x56507c(0x1b9));
97
+ if (!this['isConnected']()) throw new _common.Exceptions['NoActiveSession']();
112
98
 
113
- const _0x214c49 = this;
99
+ const _0x5a31a9 = this;
114
100
 
115
- return new Promise(function (_0x5d5231, _0x40cee2) {
116
- _0x214c49[_0xd3f1('0xe')]['sendRequest'](_0x214c49[_0xd3f1('0x6')], 'subscribe', _0x43b4b8)['then'](function (_0x44acd7) {
117
- _0x214c49[_0xd3f1('0xb')]['debug'](_0xd3f1('0x1d') + _0x43b4b8['event_name'] + '\x27\x20was\x20successful,\x20ID\x20=\x20' + _0x44acd7);
101
+ return new Promise(function (_0x26a73e, _0x41e16b) {
102
+ const _0x59862d = _0x56507c;
118
103
 
119
- _0x214c49[_0xd3f1('0x8')][_0xd3f1('0x1e')](new EventSubscription(_0x44acd7, _0x43b4b8, _0xd67385));
120
-
121
- _0x5d5231(_0x44acd7);
122
- }, function (_0x3cc2e2) {
123
- _0x214c49[_0xd3f1('0xb')][_0xd3f1('0x1f')](_0xd3f1('0x1d') + _0x43b4b8[_0xd3f1('0x1a')] + _0xd3f1('0x20') + _0x3cc2e2);
124
-
125
- _0x40cee2(_0x3cc2e2);
104
+ _0x5a31a9[_0x59862d(0x19e)][_0x59862d(0x184)](_0x5a31a9[_0x59862d(0x185)], _0x59862d(0x1cb), _0x359a76)['then'](function (_0x4e69fa) {
105
+ const _0x32a3c2 = _0x59862d;
106
+ _0x5a31a9[_0x32a3c2(0x177)][_0x32a3c2(0x1a0)](_0x32a3c2(0x1cd) + _0x359a76[_0x32a3c2(0x17e)] + _0x32a3c2(0x1b1) + _0x4e69fa), _0x5a31a9['_activeSubscriptions'][_0x32a3c2(0x1a2)](new EventSubscription(_0x4e69fa, _0x359a76, _0x56d21a)), _0x26a73e(_0x4e69fa);
107
+ }, function (_0x1db867) {
108
+ const _0x23a90a = _0x59862d;
109
+ _0x5a31a9[_0x23a90a(0x177)][_0x23a90a(0x1ac)](_0x23a90a(0x1cd) + _0x359a76[_0x23a90a(0x17e)] + _0x23a90a(0x1b2) + _0x1db867), _0x41e16b(_0x1db867);
126
110
  });
127
111
  });
128
112
  }
129
113
 
130
- [_0xd3f1('0x21')](_0x4e04b9) {
131
- if (!_0x4e04b9) {
132
- throw new _common.Exceptions[_0xd3f1('0x1b')](_0xd3f1('0x22'));
133
- }
134
-
135
- if (!this[_0xd3f1('0x16')]()) {
136
- throw new _common.Exceptions[_0xd3f1('0x14')]();
137
- }
138
-
139
- this[_0xd3f1('0xb')][_0xd3f1('0x23')](_0xd3f1('0x24') + _0x4e04b9);
140
-
141
- const _0x83bc6 = this;
114
+ [a0_0x3a92ef(0x1c5)](_0x52d30a) {
115
+ const _0x10d0af = a0_0x3a92ef;
116
+ if (!_0x52d30a) throw new _common.Exceptions[_0x10d0af(0x189)](_0x10d0af(0x19c));
117
+ if (!this[_0x10d0af(0x18a)]()) throw new _common.Exceptions[_0x10d0af(0x18f)]();
142
118
 
143
- return new Promise(function (_0x174ff1, _0x29ebf2) {
144
- _0x83bc6[_0xd3f1('0xe')][_0xd3f1('0x25')](_0x83bc6[_0xd3f1('0x6')], _0xd3f1('0x21'), {
145
- 'id': _0x4e04b9
146
- })[_0xd3f1('0x26')](_0x4de5ee => {
147
- _0x83bc6[_0xd3f1('0xb')][_0xd3f1('0x23')](_0xd3f1('0x27') + _0x4e04b9 + _0xd3f1('0x28'));
119
+ this['log'][_0x10d0af(0x1ae)](_0x10d0af(0x1ad) + _0x52d30a);
148
120
 
149
- _0x83bc6['_removeSubscription'](_0x4e04b9);
121
+ const _0x284315 = this;
150
122
 
151
- _0x174ff1(_0x4de5ee);
152
- }, _0x149e82 => {
153
- _0x83bc6[_0xd3f1('0xb')]['warning'](_0xd3f1('0x29') + _0x4e04b9 + _0xd3f1('0x20') + _0x149e82);
123
+ return new Promise(function (_0x20375e, _0x3f48ba) {
124
+ const _0x2d1127 = _0x10d0af;
154
125
 
155
- _0x29ebf2(_0x149e82);
126
+ _0x284315[_0x2d1127(0x19e)][_0x2d1127(0x184)](_0x284315['_socket'], _0x2d1127(0x1c5), {
127
+ 'id': _0x52d30a
128
+ })[_0x2d1127(0x18e)](_0x29a9c2 => {
129
+ const _0x101a81 = _0x2d1127;
130
+ _0x284315[_0x101a81(0x177)][_0x101a81(0x1ae)](_0x101a81(0x178) + _0x52d30a + '\x27\x20was\x20successful'), _0x284315[_0x101a81(0x1bc)](_0x52d30a), _0x20375e(_0x29a9c2);
131
+ }, _0x5b72 => {
132
+ const _0x289da8 = _0x2d1127;
133
+ _0x284315['log'][_0x289da8(0x1ac)](_0x289da8(0x1a7) + _0x52d30a + _0x289da8(0x1b2) + _0x5b72), _0x3f48ba(_0x5b72);
156
134
  });
157
135
  });
158
136
  }
159
137
 
160
- [_0xd3f1('0x2a')](_0x1ba96b, _0x51457a) {
161
- if (!this[_0xd3f1('0x16')]()) {
162
- throw new _common.Exceptions[_0xd3f1('0x14')]();
163
- }
164
-
165
- return new Promise((_0x37e3df, _0x3d8172) => {
166
- this[_0xd3f1('0xe')][_0xd3f1('0x25')](this['_socket'], _0x1ba96b, _0x51457a)[_0xd3f1('0x26')](_0x197850 => {
167
- this['log'][_0xd3f1('0x23')](_0xd3f1('0x2b') + _0x1ba96b + '\x20was\x20successful');
168
-
169
- _0x37e3df(_0x197850);
170
- }, _0x1f34e0 => {
171
- this[_0xd3f1('0xb')][_0xd3f1('0x1f')](_0xd3f1('0x2b') + _0x1ba96b + _0xd3f1('0x2c') + _0x1f34e0);
172
-
173
- _0x3d8172(_0x1f34e0);
138
+ ['fireEvent'](_0x4e07b2, _0x1425fb) {
139
+ const _0x2b8b60 = a0_0x3a92ef;
140
+ if (!this['isConnected']()) throw new _common.Exceptions[_0x2b8b60(0x18f)]();
141
+ return new Promise((_0x21b926, _0x43c4b8) => {
142
+ const _0x5c44de = _0x2b8b60;
143
+
144
+ this[_0x5c44de(0x19e)][_0x5c44de(0x184)](this[_0x5c44de(0x185)], _0x4e07b2, _0x1425fb)[_0x5c44de(0x18e)](_0x3ddee3 => {
145
+ const _0x195a11 = _0x5c44de;
146
+ this[_0x195a11(0x177)][_0x195a11(0x1ae)]('Event\x20' + _0x4e07b2 + '\x20was\x20successful'), _0x21b926(_0x3ddee3);
147
+ }, _0x2de057 => {
148
+ const _0x38e8bf = _0x5c44de;
149
+ this[_0x38e8bf(0x177)][_0x38e8bf(0x1ac)](_0x38e8bf(0x19d) + _0x4e07b2 + '\x20failed:\x20' + _0x2de057), _0x43c4b8(_0x2de057);
174
150
  });
175
151
  });
176
152
  }
177
153
 
178
- [_0xd3f1('0x2d')](_0x555e9e) {
179
- for (let _0x471c2c in this[_0xd3f1('0x8')]) {
180
- if (this[_0xd3f1('0x8')][_0x471c2c]['id'] === _0x555e9e) {
181
- this[_0xd3f1('0xb')][_0xd3f1('0x2e')]('Removed\x20local\x20subscription:\x20' + _0x555e9e);
154
+ ['_removeSubscription'](_0x3bdf69) {
155
+ const _0x17968d = a0_0x3a92ef;
182
156
 
183
- this[_0xd3f1('0x8')][_0xd3f1('0x2f')](_0x471c2c, 0x1);
184
-
185
- return !![];
186
- }
157
+ for (let _0x246fdb in this['_activeSubscriptions']) {
158
+ if (this[_0x17968d(0x17f)][_0x246fdb]['id'] === _0x3bdf69) return this['log'][_0x17968d(0x1a0)]('Removed\x20local\x20subscription:\x20' + _0x3bdf69), this[_0x17968d(0x17f)][_0x17968d(0x1cc)](_0x246fdb, 0x1), !![];
187
159
  }
188
160
 
189
- this['log']['warning']('Unable\x20to\x20remove\x20subscription\x20' + _0x555e9e + _0xd3f1('0x30'));
190
- return ![];
161
+ return this[_0x17968d(0x177)][_0x17968d(0x1ac)](_0x17968d(0x183) + _0x3bdf69 + '\x20locally,\x20not\x20found?'), ![];
191
162
  }
192
163
 
193
- ['_connectServer']() {
194
- this[_0xd3f1('0xb')][_0xd3f1('0x23')](_0xd3f1('0x31') + this['_serverAddress']);
164
+ [a0_0x3a92ef(0x1ab)]() {
165
+ const _0x1a1223 = a0_0x3a92ef;
195
166
 
196
- const _0x484469 = this;
167
+ this[_0x1a1223(0x177)]['info'](_0x1a1223(0x1b7) + this[_0x1a1223(0x1b5)]);
197
168
 
198
- return new Promise(function (_0x1e35ec, _0x2b2486) {
199
- if (_0x484469['_socket']) {
200
- switch (_0x484469[_0xd3f1('0x6')][_0xd3f1('0x13')]) {
201
- case 0x0:
202
- _0x2b2486('Unable\x20to\x20connect,\x20already\x20connecting');
169
+ const _0x4b4af8 = this;
203
170
 
204
- return;
171
+ return new Promise(function (_0x29fa7b, _0x1f1a7e) {
172
+ const _0x516214 = _0x1a1223;
173
+ if (_0x4b4af8[_0x516214(0x185)]) switch (_0x4b4af8[_0x516214(0x185)][_0x516214(0x181)]) {
174
+ case 0x0:
175
+ _0x1f1a7e(_0x516214(0x17a));
205
176
 
206
- case 0x1:
207
- _0x2b2486(_0xd3f1('0x32'));
177
+ return;
208
178
 
209
- return;
179
+ case 0x1:
180
+ _0x1f1a7e(_0x516214(0x1bf));
210
181
 
211
- case 0x2:
212
- _0x2b2486(_0xd3f1('0x33'));
182
+ return;
213
183
 
214
- return;
215
- }
216
- }
184
+ case 0x2:
185
+ _0x1f1a7e(_0x516214(0x192));
217
186
 
218
- _0x484469[_0xd3f1('0x6')] = new WebSocket(_0x484469[_0xd3f1('0x10')]);
219
-
220
- let _0x1e5c1b = ![];
221
-
222
- _0x484469[_0xd3f1('0x6')]['addEventListener']('open', function () {
223
- _0x484469[_0xd3f1('0xb')]['info']('Successfully\x20connected\x20to\x20event\x20service');
187
+ return;
188
+ }
189
+ _0x4b4af8['_socket'] = new WebSocket(_0x4b4af8['_serverAddress']);
224
190
 
225
- _0x1e5c1b = !![];
226
- _0x484469[_0xd3f1('0x9')] = !![];
227
- _0x484469[_0xd3f1('0xa')] = RETRY_INTERVAL_START;
191
+ let _0x3897eb = ![];
228
192
 
229
- _0x484469[_0xd3f1('0x6')][_0xd3f1('0x34')](_0xd3f1('0x35'), function (_0x209346) {
230
- _0x484469[_0xd3f1('0xe')][_0xd3f1('0x36')](_0x484469['_socket'], _0x209346[_0xd3f1('0x37')]);
231
- });
193
+ _0x4b4af8[_0x516214(0x185)][_0x516214(0x18d)](_0x516214(0x17b), function () {
194
+ const _0x5128b4 = _0x516214;
195
+ _0x4b4af8[_0x5128b4(0x177)][_0x5128b4(0x1ae)](_0x5128b4(0x18c)), _0x3897eb = !![], _0x4b4af8[_0x5128b4(0x198)] = !![], _0x4b4af8['_reconnectRetrySeconds'] = RETRY_INTERVAL_START, _0x4b4af8[_0x5128b4(0x185)][_0x5128b4(0x18d)]('message', function (_0x36a2b7) {
196
+ const _0x1a692c = _0x5128b4;
232
197
 
233
- clearTimeout(_0x484469['_pingTimerObj']);
234
- _0x484469[_0xd3f1('0x38')] = setInterval(function () {
235
- _0x484469[_0xd3f1('0xe')]['ping'](_0x484469['_socket'])[_0xd3f1('0x26')](function () {}, function (_0x4af516) {
236
- _0x484469['log']['warning'](_0xd3f1('0x39') + _0x4af516);
198
+ _0x4b4af8['_requestor'][_0x1a692c(0x191)](_0x4b4af8[_0x1a692c(0x185)], _0x36a2b7[_0x1a692c(0x1ca)]);
199
+ }), clearTimeout(_0x4b4af8['_pingTimerObj']), _0x4b4af8[_0x5128b4(0x1c2)] = setInterval(function () {
200
+ const _0x4c14e3 = _0x5128b4;
237
201
 
238
- _0x484469[_0xd3f1('0x3a')]();
202
+ _0x4b4af8['_requestor'][_0x4c14e3(0x1a9)](_0x4b4af8[_0x4c14e3(0x185)])[_0x4c14e3(0x18e)](function () {}, function (_0x49f44b) {
203
+ const _0x1f256f = _0x4c14e3;
204
+ _0x4b4af8['log'][_0x1f256f(0x1ac)]('Ping\x20failed:\x20' + _0x49f44b), _0x4b4af8[_0x1f256f(0x1c3)]();
239
205
  });
240
- }, PING_INTERVAL * 0x3e8);
241
- _0x484469[_0xd3f1('0x7')] = _0x484469[_0xd3f1('0x8')];
242
- _0x484469[_0xd3f1('0x8')] = [];
206
+ }, PING_INTERVAL * 0x3e8), _0x4b4af8['_previousSubscriptions'] = _0x4b4af8['_activeSubscriptions'], _0x4b4af8[_0x5128b4(0x17f)] = [];
243
207
 
244
- for (let _0x514ab4 of _0x484469[_0xd3f1('0x7')]) {
245
- _0x484469['subscribe'](_0x514ab4['specification'], _0x514ab4['callback'])[_0xd3f1('0x3b')](function (_0x3cde53) {
246
- _0x484469[_0xd3f1('0xb')][_0xd3f1('0x3c')](_0xd3f1('0x3d') + _0x514ab4['specification'][_0xd3f1('0x1a')] + _0xd3f1('0x2c') + _0x3cde53);
208
+ for (let _0x4954be of _0x4b4af8[_0x5128b4(0x1bd)]) {
209
+ _0x4b4af8['subscribe'](_0x4954be[_0x5128b4(0x19b)], _0x4954be[_0x5128b4(0x17c)])[_0x5128b4(0x17d)](function (_0x2049f8) {
210
+ const _0x578b26 = _0x5128b4;
211
+
212
+ _0x4b4af8[_0x578b26(0x177)][_0x578b26(0x1af)](_0x578b26(0x194) + _0x4954be['specification'][_0x578b26(0x17e)] + _0x578b26(0x1b8) + _0x2049f8);
247
213
  });
248
214
  }
249
215
 
250
- _0x1e35ec();
251
- });
252
-
253
- _0x484469[_0xd3f1('0x6')][_0xd3f1('0x34')](_0xd3f1('0x15'), function () {
254
- _0x484469[_0xd3f1('0xb')][_0xd3f1('0x23')](_0xd3f1('0x3e'));
255
-
256
- clearTimeout(_0x484469[_0xd3f1('0x38')]);
257
-
258
- _0x484469[_0xd3f1('0x3a')]();
259
- });
260
-
261
- _0x484469['_socket'][_0xd3f1('0x34')](_0xd3f1('0x3c'), function (_0x190a08) {
262
- _0x484469[_0xd3f1('0xb')]['error'](_0xd3f1('0x3f'));
263
-
264
- if (!_0x1e5c1b) {
265
- _0x2b2486(_0xd3f1('0x40') + _0x190a08);
266
- }
216
+ _0x29fa7b();
217
+ }), _0x4b4af8[_0x516214(0x185)][_0x516214(0x18d)](_0x516214(0x1aa), function () {
218
+ const _0x1f4b3b = _0x516214;
219
+ _0x4b4af8[_0x1f4b3b(0x177)][_0x1f4b3b(0x1ae)](_0x1f4b3b(0x182)), clearTimeout(_0x4b4af8['_pingTimerObj']), _0x4b4af8['_reconnectServer']();
220
+ }), _0x4b4af8[_0x516214(0x185)]['addEventListener'](_0x516214(0x1af), function (_0x16fff2) {
221
+ const _0x15a513 = _0x516214;
222
+ _0x4b4af8[_0x15a513(0x177)][_0x15a513(0x1af)](_0x15a513(0x1a1)), !_0x3897eb && _0x1f1a7e('Unable\x20to\x20connect:\x20' + _0x16fff2);
267
223
  });
268
224
  });
269
225
  }
270
226
 
271
- [_0xd3f1('0x3a')]() {
272
- if (this[_0xd3f1('0x9')]) {
273
- const _0x59f89f = Math[_0xd3f1('0x41')](this[_0xd3f1('0xa')]);
227
+ [a0_0x3a92ef(0x1c3)]() {
228
+ const _0x32265b = a0_0x3a92ef;
274
229
 
275
- this['log'][_0xd3f1('0x23')](_0xd3f1('0x42') + _0x59f89f + _0xd3f1('0x43'));
230
+ if (this['_autoReconnect']) {
231
+ const _0x72029b = Math[_0x32265b(0x1bb)](this['_reconnectRetrySeconds']);
276
232
 
277
- const _0x34a5e7 = this;
233
+ this[_0x32265b(0x177)][_0x32265b(0x1ae)](_0x32265b(0x193) + _0x72029b + '\x20secs');
234
+
235
+ const _0x2ddcc4 = this;
278
236
 
279
237
  setTimeout(function () {
280
- _0x34a5e7[_0xd3f1('0x11')]()[_0xd3f1('0x26')](function () {
281
- _0x34a5e7[_0xd3f1('0xb')][_0xd3f1('0x23')](_0xd3f1('0x44'));
238
+ const _0x3652f9 = _0x32265b;
239
+ _0x2ddcc4['_connectServer']()[_0x3652f9(0x18e)](function () {
240
+ const _0x489ec1 = _0x3652f9;
241
+
242
+ _0x2ddcc4[_0x489ec1(0x177)]['info'](_0x489ec1(0x19a));
282
243
  }, function () {
283
- _0x34a5e7[_0xd3f1('0xb')][_0xd3f1('0x1f')](_0xd3f1('0x45'));
284
- });
244
+ const _0x3f13c0 = _0x3652f9;
285
245
 
286
- if (_0x34a5e7[_0xd3f1('0xa')] <= RETRY_MAX_BACKOFF) {
287
- _0x34a5e7[_0xd3f1('0xa')] = _0x34a5e7[_0xd3f1('0xa')] * 0x2;
288
- }
289
- }, _0x34a5e7[_0xd3f1('0xa')] * 0x3e8);
290
- } else {
291
- this[_0xd3f1('0xb')][_0xd3f1('0x23')]('Auto\x20reconnect\x20disabled\x20(disconnecting?)');
292
- }
246
+ _0x2ddcc4[_0x3f13c0(0x177)][_0x3f13c0(0x1ac)]('Reconnect\x20attempt\x20failed');
247
+ }), _0x2ddcc4[_0x3652f9(0x1ba)] <= RETRY_MAX_BACKOFF && (_0x2ddcc4['_reconnectRetrySeconds'] = _0x2ddcc4[_0x3652f9(0x1ba)] * 0x2);
248
+ }, _0x2ddcc4[_0x32265b(0x1ba)] * 0x3e8);
249
+ } else this['log'][_0x32265b(0x1ae)](_0x32265b(0x1be));
293
250
  }
294
251
 
295
- ['_handleIncomingEvent'](_0x45a77b) {
296
- const _0x2e9781 = _0x45a77b['data'][_0xd3f1('0x46')];
252
+ ['_handleIncomingEvent'](_0x325c99) {
253
+ const _0x1255e8 = a0_0x3a92ef,
254
+ _0x58dab0 = _0x325c99[_0x1255e8(0x1ca)]['subscription_id'];
297
255
 
298
- for (let _0x5a8ee1 of this[_0xd3f1('0x8')]) {
299
- if (_0x5a8ee1['id'] === _0x2e9781) {
300
- this[_0xd3f1('0xb')][_0xd3f1('0x2e')](_0xd3f1('0x47') + _0x5a8ee1['id'] + _0xd3f1('0x48') + JSON['stringify'](_0x45a77b[_0xd3f1('0x37')][_0xd3f1('0x49')]));
256
+ for (let _0x5b893c of this[_0x1255e8(0x17f)]) {
257
+ if (_0x5b893c['id'] === _0x58dab0) {
258
+ this[_0x1255e8(0x177)][_0x1255e8(0x1a0)](_0x1255e8(0x1b6) + _0x5b893c['id'] + _0x1255e8(0x1b4) + JSON[_0x1255e8(0x187)](_0x325c99[_0x1255e8(0x1ca)][_0x1255e8(0x19f)]));
301
259
 
302
260
  try {
303
- _0x5a8ee1[_0xd3f1('0x3')](_0x45a77b[_0xd3f1('0x37')][_0xd3f1('0x49')]);
304
- } catch (_0x39fe4b) {
305
- this['log'][_0xd3f1('0x1f')](_0xd3f1('0x4a') + _0x39fe4b);
306
-
307
- _0x45a77b[_0xd3f1('0x4b')]();
261
+ _0x5b893c['callback'](_0x325c99[_0x1255e8(0x1ca)]['payload']);
262
+ } catch (_0x5d702d) {
263
+ this[_0x1255e8(0x177)][_0x1255e8(0x1ac)](_0x1255e8(0x18b) + _0x5d702d), _0x325c99[_0x1255e8(0x1a6)]();
308
264
  }
309
265
 
310
- _0x45a77b[_0xd3f1('0x4b')]();
266
+ _0x325c99[_0x1255e8(0x1a6)]();
311
267
 
312
268
  return;
313
269
  }
314
270
  }
315
271
 
316
- _0x45a77b[_0xd3f1('0x4c')](_0xd3f1('0x4d') + _0x2e9781);
272
+ _0x325c99[_0x1255e8(0x180)](_0x1255e8(0x1a8) + _0x58dab0);
317
273
  }
318
274
 
319
275
  }
package/es5/index.js CHANGED
File without changes