@telegenta/webclient 2.0.11 → 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 -220
  48. package/es5/index.js +0 -0
  49. package/es5/phone-client.js +774 -1177
  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,314 +7,269 @@ exports.EventClient = void 0;
7
7
 
8
8
  var _common = require("@telegenta/common");
9
9
 
10
- var _0x26cf = ['disconnect', '_socket', 'NoActiveSession', 'close', 'readyState', 'subscribe', 'InvalidParameter', 'You\x20must\x20specify\x20both\x20event\x20spec\x20and\x20callback\x20function', 'event_name', 'sendRequest', 'then', 'Subscription\x20to\x20\x27', '\x27\x20was\x20successful,\x20ID\x20=\x20', 'push', 'log', '\x27\x20failed:\x20', 'You\x20must\x20specify\x20subscription\x20id', 'isConnected', 'info', 'Unsubscribe\x20id:\x20', 'unsubscribe', 'Unsubscribe\x20to\x20\x27', '\x27\x20was\x20successful', 'warning', 'Remote\x20unsubscribe\x20to\x20\x27', 'fireEvent', 'Event\x20', '\x20was\x20successful', '\x20failed:\x20', '_removeSubscription', 'Removed\x20local\x20subscription:\x20', '_connectServer', 'Connecting\x20to\x20event\x20server:\x20', '_serverAddress', 'Unable\x20to\x20connect,\x20already\x20connecting', 'Unable\x20to\x20connect,\x20already\x20connected', 'Unable\x20to\x20connect,\x20socket\x20is\x20still\x20closing', 'open', '_reconnectRetrySeconds', 'addEventListener', 'message', 'receiveMessage', 'data', 'ping', '_reconnectServer', 'catch', 'Disconnected\x20from\x20event\x20service', 'error', 'floor', 'Reconnecting\x20in\x20', '\x20secs', 'Auto\x20reconnect\x20disabled\x20(disconnecting?)', '_handleIncomingEvent', 'Received\x20event\x20for\x20subcription\x20id\x20', '\x20payload:\x20', 'stringify', 'payload', 'Callback\x20had\x20unhandled\x20exception\x20', 'resolve', 'reject', 'Invalid\x20subscription\x20id\x20for\x20event:\x20', 'wss://api.telegenta.com/es/', 'specification', 'callback', 'doCallback', 'apply', '_previousSubscriptions', '_activeSubscriptions', '_pingTimerObj', '_autoReconnect', 'LogHandler', 'LOGLVL', 'ERROR', '_requestor', 'event', 'connect'];
11
-
12
- (function (_0x58d96e, _0x4efa09) {
13
- var _0x19dafb = function _0x19dafb(_0x5d72d9) {
14
- while (--_0x5d72d9) {
15
- _0x58d96e['push'](_0x58d96e['shift']());
16
- }
17
- };
10
+ const a0_0x3a92ef = a0_0x488e;
18
11
 
19
- _0x19dafb(++_0x4efa09);
20
- })(_0x26cf, 0x16d);
12
+ (function (_0x12d3b3, _0x32fdfc) {
13
+ const _0x5a3514 = a0_0x488e,
14
+ _0x3c9baf = _0x12d3b3();
21
15
 
22
- var _0x5f41 = function _0x5f41(_0x4a7d5a, _0x5d39ed) {
23
- _0x4a7d5a = _0x4a7d5a - 0x0;
24
- var _0x35c1fd = _0x26cf[_0x4a7d5a];
25
- return _0x35c1fd;
26
- };
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);
27
19
 
28
- 'use strict';
20
+ if (_0x43507d === _0x32fdfc) break;else _0x3c9baf['push'](_0x3c9baf['shift']());
21
+ } catch (_0x2f5b4c) {
22
+ _0x3c9baf['push'](_0x3c9baf['shift']());
23
+ }
24
+ }
25
+ })(a0_0x4c0a, 0xe39ca);
29
26
 
30
- const PING_INTERVAL = 0x32;
27
+ function a0_0x488e(_0x47c6e3, _0x5aa6aa) {
28
+ const _0x4c0a77 = a0_0x4c0a();
31
29
 
32
- const ES_DEFAULT_SERVER_URL = _0x5f41('0x0');
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
+ }
33
36
 
34
- const RETRY_INTERVAL_START = 0x1 + Math['random']();
35
- 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;
36
41
 
37
42
  class EventSubscription {
38
- constructor(_0x39629b, _0x2ba0f1, _0xe05c14) {
39
- this['id'] = _0x39629b;
40
- this[_0x5f41('0x1')] = _0x2ba0f1;
41
- this[_0x5f41('0x2')] = _0xe05c14;
43
+ constructor(_0x4fba20, _0x7c38f5, _0x59affb) {
44
+ const _0xf29903 = a0_0x3a92ef;
45
+ this['id'] = _0x4fba20, this[_0xf29903(0x19b)] = _0x7c38f5, this[_0xf29903(0x17c)] = _0x59affb;
42
46
  }
43
47
 
44
- [_0x5f41('0x3')](_0x414fe3, _0x23f65a) {
45
- return this[_0x5f41('0x2')][_0x5f41('0x4')](_0x414fe3, [_0x23f65a]);
48
+ [a0_0x3a92ef(0x186)](_0x53b5b2, _0x509ac7) {
49
+ const _0x44d374 = a0_0x3a92ef;
50
+ return this[_0x44d374(0x17c)][_0x44d374(0x1b3)](_0x53b5b2, [_0x509ac7]);
46
51
  }
47
52
 
48
53
  }
49
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
+
50
65
  class EventClient {
51
66
  constructor() {
52
- let _0x198b97 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
53
-
54
- this['_socket'] = null;
55
- this[_0x5f41('0x5')] = [];
56
- this[_0x5f41('0x6')] = [];
57
- this[_0x5f41('0x7')] = null;
58
- this[_0x5f41('0x8')] = ![];
59
- this['_reconnectRetrySeconds'] = RETRY_INTERVAL_START;
60
- this['log'] = _0x198b97 ? _0x198b97 : new _common.Logger[_0x5f41('0x9')](_common.Logger[_0x5f41('0xa')][_0x5f41('0xb')]);
61
- this['_requestor'] = new _common.Requestor(this['log']);
62
-
63
- this[_0x5f41('0xc')]['on'](_0x5f41('0xd'), _0x221354 => {
64
- this['_handleIncomingEvent'](_0x221354);
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
- [_0x5f41('0xe')]() {
69
- let _0xc1772f = 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 (!_0xc1772f) {
72
- _0xc1772f = ES_DEFAULT_SERVER_URL;
73
- }
74
-
75
- this['_serverAddress'] = _0xc1772f;
76
- this[_0x5f41('0x5')] = [];
77
- this[_0x5f41('0x6')] = [];
78
- return this['_connectServer']();
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
- [_0x5f41('0xf')]() {
82
- if (this[_0x5f41('0x10')]['readyState'] !== 0x1) {
83
- throw new _common.Exceptions[_0x5f41('0x11')]();
84
- }
85
-
86
- this[_0x5f41('0x6')] = [];
87
- this[_0x5f41('0x8')] = ![];
88
-
89
- this[_0x5f41('0x10')][_0x5f41('0x12')]();
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
- ['isConnected']() {
93
- if (this[_0x5f41('0x10')]) {
94
- return this[_0x5f41('0x10')][_0x5f41('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
- [_0x5f41('0x14')](_0x1c9058, _0x2e5135) {
101
- if (!_0x1c9058 || !_0x2e5135) {
102
- throw new _common.Exceptions[_0x5f41('0x15')](_0x5f41('0x16'));
103
- }
104
-
105
- if (!_0x1c9058['hasOwnProperty'](_0x5f41('0x17'))) {
106
- throw new _common.Exceptions[_0x5f41('0x15')]('Your\x20event\x20specification\x20must\x20contain\x20event\x20name');
107
- }
108
-
109
- if (!this['isConnected']()) {
110
- throw new _common.Exceptions[_0x5f41('0x11')]();
111
- }
112
-
113
- const _0x46915b = this;
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']();
114
98
 
115
- return new Promise(function (_0x3ac380, _0x4aab71) {
116
- _0x46915b[_0x5f41('0xc')][_0x5f41('0x18')](_0x46915b[_0x5f41('0x10')], _0x5f41('0x14'), _0x1c9058)[_0x5f41('0x19')](function (_0x168a5c) {
117
- _0x46915b['log']['debug'](_0x5f41('0x1a') + _0x1c9058['event_name'] + _0x5f41('0x1b') + _0x168a5c);
99
+ const _0x5a31a9 = this;
118
100
 
119
- _0x46915b['_activeSubscriptions'][_0x5f41('0x1c')](new EventSubscription(_0x168a5c, _0x1c9058, _0x2e5135));
101
+ return new Promise(function (_0x26a73e, _0x41e16b) {
102
+ const _0x59862d = _0x56507c;
120
103
 
121
- _0x3ac380(_0x168a5c);
122
- }, function (_0x55cef6) {
123
- _0x46915b[_0x5f41('0x1d')]['warning'](_0x5f41('0x1a') + _0x1c9058[_0x5f41('0x17')] + _0x5f41('0x1e') + _0x55cef6);
124
-
125
- _0x4aab71(_0x55cef6);
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
- ['unsubscribe'](_0x4148dd) {
131
- if (!_0x4148dd) {
132
- throw new _common.Exceptions[_0x5f41('0x15')](_0x5f41('0x1f'));
133
- }
134
-
135
- if (!this[_0x5f41('0x20')]()) {
136
- throw new _common.Exceptions[_0x5f41('0x11')]();
137
- }
138
-
139
- this[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x22') + _0x4148dd);
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)]();
140
118
 
141
- const _0x8135e = this;
119
+ this['log'][_0x10d0af(0x1ae)](_0x10d0af(0x1ad) + _0x52d30a);
142
120
 
143
- return new Promise(function (_0x42bdcb, _0x159dbc) {
144
- _0x8135e[_0x5f41('0xc')][_0x5f41('0x18')](_0x8135e[_0x5f41('0x10')], _0x5f41('0x23'), {
145
- 'id': _0x4148dd
146
- })['then'](_0x2100fe => {
147
- _0x8135e[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x24') + _0x4148dd + _0x5f41('0x25'));
121
+ const _0x284315 = this;
148
122
 
149
- _0x8135e['_removeSubscription'](_0x4148dd);
123
+ return new Promise(function (_0x20375e, _0x3f48ba) {
124
+ const _0x2d1127 = _0x10d0af;
150
125
 
151
- _0x42bdcb(_0x2100fe);
152
- }, _0x3b5189 => {
153
- _0x8135e[_0x5f41('0x1d')][_0x5f41('0x26')](_0x5f41('0x27') + _0x4148dd + _0x5f41('0x1e') + _0x3b5189);
154
-
155
- _0x159dbc(_0x3b5189);
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
- [_0x5f41('0x28')](_0x5e87c0, _0x322a2f) {
161
- if (!this[_0x5f41('0x20')]()) {
162
- throw new _common.Exceptions['NoActiveSession']();
163
- }
164
-
165
- return new Promise((_0x518d32, _0x3f07bb) => {
166
- this['_requestor'][_0x5f41('0x18')](this[_0x5f41('0x10')], _0x5e87c0, _0x322a2f)[_0x5f41('0x19')](_0x3facb5 => {
167
- this['log'][_0x5f41('0x21')](_0x5f41('0x29') + _0x5e87c0 + _0x5f41('0x2a'));
168
-
169
- _0x518d32(_0x3facb5);
170
- }, _0x5d633f => {
171
- this[_0x5f41('0x1d')][_0x5f41('0x26')](_0x5f41('0x29') + _0x5e87c0 + _0x5f41('0x2b') + _0x5d633f);
172
-
173
- _0x3f07bb(_0x5d633f);
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
- [_0x5f41('0x2c')](_0x207ba2) {
179
- for (let _0xf85798 in this[_0x5f41('0x6')]) {
180
- if (this[_0x5f41('0x6')][_0xf85798]['id'] === _0x207ba2) {
181
- this[_0x5f41('0x1d')]['debug'](_0x5f41('0x2d') + _0x207ba2);
182
-
183
- this[_0x5f41('0x6')]['splice'](_0xf85798, 0x1);
154
+ ['_removeSubscription'](_0x3bdf69) {
155
+ const _0x17968d = a0_0x3a92ef;
184
156
 
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[_0x5f41('0x1d')]['warning']('Unable\x20to\x20remove\x20subscription\x20' + _0x207ba2 + '\x20locally,\x20not\x20found?');
190
-
191
- return ![];
161
+ return this[_0x17968d(0x177)][_0x17968d(0x1ac)](_0x17968d(0x183) + _0x3bdf69 + '\x20locally,\x20not\x20found?'), ![];
192
162
  }
193
163
 
194
- [_0x5f41('0x2e')]() {
195
- this[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x2f') + this[_0x5f41('0x30')]);
164
+ [a0_0x3a92ef(0x1ab)]() {
165
+ const _0x1a1223 = a0_0x3a92ef;
196
166
 
197
- const _0x274a25 = this;
167
+ this[_0x1a1223(0x177)]['info'](_0x1a1223(0x1b7) + this[_0x1a1223(0x1b5)]);
198
168
 
199
- return new Promise(function (_0xe351c8, _0x4696ae) {
200
- if (_0x274a25[_0x5f41('0x10')]) {
201
- switch (_0x274a25[_0x5f41('0x10')][_0x5f41('0x13')]) {
202
- case 0x0:
203
- _0x4696ae(_0x5f41('0x31'));
169
+ const _0x4b4af8 = this;
204
170
 
205
- 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));
206
176
 
207
- case 0x1:
208
- _0x4696ae(_0x5f41('0x32'));
177
+ return;
209
178
 
210
- return;
179
+ case 0x1:
180
+ _0x1f1a7e(_0x516214(0x1bf));
211
181
 
212
- case 0x2:
213
- _0x4696ae(_0x5f41('0x33'));
182
+ return;
214
183
 
215
- return;
216
- }
217
- }
184
+ case 0x2:
185
+ _0x1f1a7e(_0x516214(0x192));
218
186
 
219
- _0x274a25[_0x5f41('0x10')] = new WebSocket(_0x274a25['_serverAddress']);
220
-
221
- let _0x34582e = ![];
222
-
223
- _0x274a25[_0x5f41('0x10')]['addEventListener'](_0x5f41('0x34'), function () {
224
- _0x274a25[_0x5f41('0x1d')][_0x5f41('0x21')]('Successfully\x20connected\x20to\x20event\x20service');
187
+ return;
188
+ }
189
+ _0x4b4af8['_socket'] = new WebSocket(_0x4b4af8['_serverAddress']);
225
190
 
226
- _0x34582e = !![];
227
- _0x274a25['_autoReconnect'] = !![];
228
- _0x274a25[_0x5f41('0x35')] = RETRY_INTERVAL_START;
191
+ let _0x3897eb = ![];
229
192
 
230
- _0x274a25[_0x5f41('0x10')][_0x5f41('0x36')](_0x5f41('0x37'), function (_0x3cc0ce) {
231
- _0x274a25[_0x5f41('0xc')][_0x5f41('0x38')](_0x274a25[_0x5f41('0x10')], _0x3cc0ce[_0x5f41('0x39')]);
232
- });
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;
233
197
 
234
- clearTimeout(_0x274a25[_0x5f41('0x7')]);
235
- _0x274a25[_0x5f41('0x7')] = setInterval(function () {
236
- _0x274a25[_0x5f41('0xc')][_0x5f41('0x3a')](_0x274a25[_0x5f41('0x10')])[_0x5f41('0x19')](function () {}, function (_0x4eeed4) {
237
- _0x274a25[_0x5f41('0x1d')][_0x5f41('0x26')]('Ping\x20failed:\x20' + _0x4eeed4);
198
+ _0x4b4af8['_requestor'][_0x1a692c(0x191)](_0x4b4af8[_0x1a692c(0x185)], _0x36a2b7[_0x1a692c(0x1ca)]);
199
+ }), clearTimeout(_0x4b4af8['_pingTimerObj']), _0x4b4af8[_0x5128b4(0x1c2)] = setInterval(function () {
200
+ const _0x4c14e3 = _0x5128b4;
238
201
 
239
- _0x274a25[_0x5f41('0x3b')]();
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)]();
240
205
  });
241
- }, PING_INTERVAL * 0x3e8);
242
- _0x274a25[_0x5f41('0x5')] = _0x274a25[_0x5f41('0x6')];
243
- _0x274a25[_0x5f41('0x6')] = [];
206
+ }, PING_INTERVAL * 0x3e8), _0x4b4af8['_previousSubscriptions'] = _0x4b4af8['_activeSubscriptions'], _0x4b4af8[_0x5128b4(0x17f)] = [];
244
207
 
245
- for (let _0x4a07ca of _0x274a25[_0x5f41('0x5')]) {
246
- _0x274a25[_0x5f41('0x14')](_0x4a07ca[_0x5f41('0x1')], _0x4a07ca[_0x5f41('0x2')])[_0x5f41('0x3c')](function (_0x2430a1) {
247
- _0x274a25[_0x5f41('0x1d')]['error']('Resubscribing\x20to\x20' + _0x4a07ca['specification'][_0x5f41('0x17')] + '\x20failed:\x20' + _0x2430a1);
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);
248
213
  });
249
214
  }
250
215
 
251
- _0xe351c8();
252
- });
253
-
254
- _0x274a25[_0x5f41('0x10')]['addEventListener'](_0x5f41('0x12'), function () {
255
- _0x274a25[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x3d'));
256
-
257
- clearTimeout(_0x274a25['_pingTimerObj']);
258
-
259
- _0x274a25[_0x5f41('0x3b')]();
260
- });
261
-
262
- _0x274a25['_socket'][_0x5f41('0x36')]('error', function (_0x5278a9) {
263
- _0x274a25[_0x5f41('0x1d')][_0x5f41('0x3e')]('Websocket\x20connection\x20error');
264
-
265
- if (!_0x34582e) {
266
- _0x4696ae('Unable\x20to\x20connect:\x20' + _0x5278a9);
267
- }
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);
268
223
  });
269
224
  });
270
225
  }
271
226
 
272
- [_0x5f41('0x3b')]() {
273
- if (this[_0x5f41('0x8')]) {
274
- const _0x24937b = Math[_0x5f41('0x3f')](this[_0x5f41('0x35')]);
227
+ [a0_0x3a92ef(0x1c3)]() {
228
+ const _0x32265b = a0_0x3a92ef;
275
229
 
276
- this['log'][_0x5f41('0x21')](_0x5f41('0x40') + _0x24937b + _0x5f41('0x41'));
230
+ if (this['_autoReconnect']) {
231
+ const _0x72029b = Math[_0x32265b(0x1bb)](this['_reconnectRetrySeconds']);
277
232
 
278
- const _0x4108e7 = this;
233
+ this[_0x32265b(0x177)][_0x32265b(0x1ae)](_0x32265b(0x193) + _0x72029b + '\x20secs');
234
+
235
+ const _0x2ddcc4 = this;
279
236
 
280
237
  setTimeout(function () {
281
- _0x4108e7[_0x5f41('0x2e')]()[_0x5f41('0x19')](function () {
282
- _0x4108e7[_0x5f41('0x1d')]['info']('Reconnect\x20attempt\x20successful');
238
+ const _0x3652f9 = _0x32265b;
239
+ _0x2ddcc4['_connectServer']()[_0x3652f9(0x18e)](function () {
240
+ const _0x489ec1 = _0x3652f9;
241
+
242
+ _0x2ddcc4[_0x489ec1(0x177)]['info'](_0x489ec1(0x19a));
283
243
  }, function () {
284
- _0x4108e7[_0x5f41('0x1d')][_0x5f41('0x26')]('Reconnect\x20attempt\x20failed');
285
- });
244
+ const _0x3f13c0 = _0x3652f9;
286
245
 
287
- if (_0x4108e7[_0x5f41('0x35')] <= RETRY_MAX_BACKOFF) {
288
- _0x4108e7[_0x5f41('0x35')] = _0x4108e7['_reconnectRetrySeconds'] * 0x2;
289
- }
290
- }, _0x4108e7['_reconnectRetrySeconds'] * 0x3e8);
291
- } else {
292
- this[_0x5f41('0x1d')][_0x5f41('0x21')](_0x5f41('0x42'));
293
- }
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));
294
250
  }
295
251
 
296
- [_0x5f41('0x43')](_0x9c1810) {
297
- const _0x5b7540 = _0x9c1810['data']['subscription_id'];
252
+ ['_handleIncomingEvent'](_0x325c99) {
253
+ const _0x1255e8 = a0_0x3a92ef,
254
+ _0x58dab0 = _0x325c99[_0x1255e8(0x1ca)]['subscription_id'];
298
255
 
299
- for (let _0x4addd8 of this[_0x5f41('0x6')]) {
300
- if (_0x4addd8['id'] === _0x5b7540) {
301
- this[_0x5f41('0x1d')]['debug'](_0x5f41('0x44') + _0x4addd8['id'] + _0x5f41('0x45') + JSON[_0x5f41('0x46')](_0x9c1810['data'][_0x5f41('0x47')]));
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)]));
302
259
 
303
260
  try {
304
- _0x4addd8[_0x5f41('0x2')](_0x9c1810[_0x5f41('0x39')][_0x5f41('0x47')]);
305
- } catch (_0x1cc940) {
306
- this[_0x5f41('0x1d')][_0x5f41('0x26')](_0x5f41('0x48') + _0x1cc940);
307
-
308
- _0x9c1810[_0x5f41('0x49')]();
261
+ _0x5b893c['callback'](_0x325c99[_0x1255e8(0x1ca)]['payload']);
262
+ } catch (_0x5d702d) {
263
+ this[_0x1255e8(0x177)][_0x1255e8(0x1ac)](_0x1255e8(0x18b) + _0x5d702d), _0x325c99[_0x1255e8(0x1a6)]();
309
264
  }
310
265
 
311
- _0x9c1810[_0x5f41('0x49')]();
266
+ _0x325c99[_0x1255e8(0x1a6)]();
312
267
 
313
268
  return;
314
269
  }
315
270
  }
316
271
 
317
- _0x9c1810[_0x5f41('0x4a')](_0x5f41('0x4b') + _0x5b7540);
272
+ _0x325c99[_0x1255e8(0x180)](_0x1255e8(0x1a8) + _0x58dab0);
318
273
  }
319
274
 
320
275
  }
package/es5/index.js CHANGED
File without changes