pusher-js 8.4.2 → 8.5.0
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/.github/workflows/release.yml +5 -5
- package/.github/workflows/release_pr.yml +4 -4
- package/.github/workflows/run-tests.yml +13 -8
- package/CHANGELOG.md +12 -0
- package/dist/node/pusher.js +5715 -5673
- package/dist/node/pusher.js.map +1 -1
- package/dist/react-native/pusher.js +2 -8
- package/dist/react-native/pusher.js.LICENSE.txt +7 -0
- package/dist/react-native/pusher.js.map +1 -1
- package/dist/web/pusher-with-encryption.js +353 -363
- package/dist/web/pusher-with-encryption.js.map +1 -1
- package/dist/web/pusher-with-encryption.min.js +2 -8
- package/dist/web/pusher-with-encryption.min.js.LICENSE.txt +7 -0
- package/dist/web/pusher-with-encryption.min.js.map +1 -1
- package/dist/web/pusher.js +340 -348
- package/dist/web/pusher.js.map +1 -1
- package/dist/web/pusher.min.js +2 -8
- package/dist/web/pusher.min.js.LICENSE.txt +7 -0
- package/dist/web/pusher.min.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.js +327 -337
- package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.min.js +2 -8
- package/dist/worker/pusher-with-encryption.worker.min.js.LICENSE.txt +7 -0
- package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
- package/dist/worker/pusher.worker.js +314 -322
- package/dist/worker/pusher.worker.js.map +1 -1
- package/dist/worker/pusher.worker.min.js +2 -8
- package/dist/worker/pusher.worker.min.js.LICENSE.txt +7 -0
- package/dist/worker/pusher.worker.min.js.map +1 -1
- package/integration_tests_server/package-lock.json +565 -245
- package/integration_tests_server/package.json +2 -1
- package/package.json +21 -8
- package/spec/config/jasmine/webpack.integration.js +1 -1
- package/spec/config/jasmine/webpack.unit.js +1 -1
- package/spec/config/karma/config.ci.js +18 -18
- package/spec/javascripts/helpers/mocks.js +1 -0
- package/spec/javascripts/integration/index.web.js +14 -0
- package/spec/javascripts/unit/core/connection/connection_manager_spec.js +43 -0
- package/spec/javascripts/unit/core/pusher_spec.js +58 -0
- package/src/core/auth/options.ts +9 -11
- package/src/core/config.ts +23 -14
- package/src/core/connection/connection_manager.ts +9 -0
- package/src/core/options.ts +5 -0
- package/src/core/pusher.ts +17 -6
- package/types/src/core/auth/options.d.ts +5 -10
- package/types/src/core/connection/connection_manager.d.ts +1 -0
- package/types/src/core/options.d.ts +4 -0
- package/types/src/core/pusher.d.ts +3 -1
- package/webpack/config.node.js +1 -2
- package/webpack/config.react-native.js +1 -2
- package/webpack/config.shared.js +6 -6
- package/webpack/config.web.js +1 -2
- package/webpack/config.worker.js +1 -2
- package/webpack/dev.server.js +2 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Pusher JavaScript Library v8.
|
|
2
|
+
* Pusher JavaScript Library v8.5.0
|
|
3
3
|
* https://pusher.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2020, Pusher
|
|
@@ -15,96 +15,12 @@
|
|
|
15
15
|
exports["Pusher"] = factory();
|
|
16
16
|
else
|
|
17
17
|
root["Pusher"] = factory();
|
|
18
|
-
})(this,
|
|
19
|
-
return /******/ (
|
|
20
|
-
/******/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/******/ function __webpack_require__(moduleId) {
|
|
25
|
-
/******/
|
|
26
|
-
/******/ // Check if module is in cache
|
|
27
|
-
/******/ if(installedModules[moduleId]) {
|
|
28
|
-
/******/ return installedModules[moduleId].exports;
|
|
29
|
-
/******/ }
|
|
30
|
-
/******/ // Create a new module (and put it into the cache)
|
|
31
|
-
/******/ var module = installedModules[moduleId] = {
|
|
32
|
-
/******/ i: moduleId,
|
|
33
|
-
/******/ l: false,
|
|
34
|
-
/******/ exports: {}
|
|
35
|
-
/******/ };
|
|
36
|
-
/******/
|
|
37
|
-
/******/ // Execute the module function
|
|
38
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
39
|
-
/******/
|
|
40
|
-
/******/ // Flag the module as loaded
|
|
41
|
-
/******/ module.l = true;
|
|
42
|
-
/******/
|
|
43
|
-
/******/ // Return the exports of the module
|
|
44
|
-
/******/ return module.exports;
|
|
45
|
-
/******/ }
|
|
46
|
-
/******/
|
|
47
|
-
/******/
|
|
48
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
49
|
-
/******/ __webpack_require__.m = modules;
|
|
50
|
-
/******/
|
|
51
|
-
/******/ // expose the module cache
|
|
52
|
-
/******/ __webpack_require__.c = installedModules;
|
|
53
|
-
/******/
|
|
54
|
-
/******/ // define getter function for harmony exports
|
|
55
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
56
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
57
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
58
|
-
/******/ }
|
|
59
|
-
/******/ };
|
|
60
|
-
/******/
|
|
61
|
-
/******/ // define __esModule on exports
|
|
62
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
63
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
64
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
65
|
-
/******/ }
|
|
66
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
67
|
-
/******/ };
|
|
68
|
-
/******/
|
|
69
|
-
/******/ // create a fake namespace object
|
|
70
|
-
/******/ // mode & 1: value is a module id, require it
|
|
71
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
72
|
-
/******/ // mode & 4: return value when already ns object
|
|
73
|
-
/******/ // mode & 8|1: behave like require
|
|
74
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
75
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
76
|
-
/******/ if(mode & 8) return value;
|
|
77
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
78
|
-
/******/ var ns = Object.create(null);
|
|
79
|
-
/******/ __webpack_require__.r(ns);
|
|
80
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
81
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
82
|
-
/******/ return ns;
|
|
83
|
-
/******/ };
|
|
84
|
-
/******/
|
|
85
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
86
|
-
/******/ __webpack_require__.n = function(module) {
|
|
87
|
-
/******/ var getter = module && module.__esModule ?
|
|
88
|
-
/******/ function getDefault() { return module['default']; } :
|
|
89
|
-
/******/ function getModuleExports() { return module; };
|
|
90
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
91
|
-
/******/ return getter;
|
|
92
|
-
/******/ };
|
|
93
|
-
/******/
|
|
94
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
95
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
96
|
-
/******/
|
|
97
|
-
/******/ // __webpack_public_path__
|
|
98
|
-
/******/ __webpack_require__.p = "";
|
|
99
|
-
/******/
|
|
100
|
-
/******/
|
|
101
|
-
/******/ // Load entry module and return exports
|
|
102
|
-
/******/ return __webpack_require__(__webpack_require__.s = 2);
|
|
103
|
-
/******/ })
|
|
104
|
-
/************************************************************************/
|
|
105
|
-
/******/ ([
|
|
106
|
-
/* 0 */
|
|
107
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
18
|
+
})(this, () => {
|
|
19
|
+
return /******/ (() => { // webpackBootstrap
|
|
20
|
+
/******/ var __webpack_modules__ = ({
|
|
21
|
+
|
|
22
|
+
/***/ 594
|
|
23
|
+
(__unused_webpack_module, exports) {
|
|
108
24
|
|
|
109
25
|
"use strict";
|
|
110
26
|
|
|
@@ -123,7 +39,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
123
39
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
124
40
|
};
|
|
125
41
|
})();
|
|
126
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
127
43
|
/**
|
|
128
44
|
* Package base64 implements Base64 encoding and decoding.
|
|
129
45
|
*/
|
|
@@ -390,15 +306,17 @@ exports.decodedLength = function (s) {
|
|
|
390
306
|
};
|
|
391
307
|
|
|
392
308
|
|
|
393
|
-
/***/ }
|
|
394
|
-
|
|
395
|
-
/***/
|
|
309
|
+
/***/ },
|
|
310
|
+
|
|
311
|
+
/***/ 978
|
|
312
|
+
(__unused_webpack_module, exports) {
|
|
396
313
|
|
|
397
314
|
"use strict";
|
|
315
|
+
var __webpack_unused_export__;
|
|
398
316
|
|
|
399
317
|
// Copyright (C) 2016 Dmitry Chestnykh
|
|
400
318
|
// MIT License. See LICENSE file for details.
|
|
401
|
-
|
|
319
|
+
__webpack_unused_export__ = ({ value: true });
|
|
402
320
|
/**
|
|
403
321
|
* Package utf8 implements UTF-8 encoding and decoding.
|
|
404
322
|
*/
|
|
@@ -441,7 +359,7 @@ function encode(s) {
|
|
|
441
359
|
}
|
|
442
360
|
return arr;
|
|
443
361
|
}
|
|
444
|
-
|
|
362
|
+
__webpack_unused_export__ = encode;
|
|
445
363
|
/**
|
|
446
364
|
* Returns the number of bytes required to encode the given string into UTF-8.
|
|
447
365
|
* Throws if the source string has invalid UTF-16 encoding.
|
|
@@ -472,7 +390,7 @@ function encodedLength(s) {
|
|
|
472
390
|
}
|
|
473
391
|
return result;
|
|
474
392
|
}
|
|
475
|
-
|
|
393
|
+
__webpack_unused_export__ = encodedLength;
|
|
476
394
|
/**
|
|
477
395
|
* Decodes the given byte array from UTF-8 into a string.
|
|
478
396
|
* Throws if encoding is invalid.
|
|
@@ -542,34 +460,39 @@ function decode(arr) {
|
|
|
542
460
|
}
|
|
543
461
|
return chars.join("");
|
|
544
462
|
}
|
|
545
|
-
exports.
|
|
463
|
+
exports.D4 = decode;
|
|
464
|
+
|
|
546
465
|
|
|
466
|
+
/***/ },
|
|
547
467
|
|
|
548
|
-
/***/
|
|
549
|
-
|
|
550
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
468
|
+
/***/ 721
|
|
469
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
551
470
|
|
|
552
471
|
// required so we don't have to do require('pusher').default etc.
|
|
553
|
-
module.exports = __webpack_require__(
|
|
472
|
+
module.exports = __webpack_require__(288)["default"];
|
|
554
473
|
|
|
555
474
|
|
|
556
|
-
/***/ }
|
|
557
|
-
|
|
558
|
-
/***/
|
|
475
|
+
/***/ },
|
|
476
|
+
|
|
477
|
+
/***/ 288
|
|
478
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
559
479
|
|
|
560
480
|
"use strict";
|
|
561
|
-
// ESM COMPAT FLAG
|
|
562
|
-
__webpack_require__.r(__webpack_exports__);
|
|
563
481
|
|
|
564
|
-
//
|
|
482
|
+
// EXPORTS
|
|
483
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
484
|
+
"default": () => (/* binding */ pusher)
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
;// ./src/core/base64.ts
|
|
565
488
|
function encode(s) {
|
|
566
489
|
return btoa(utob(s));
|
|
567
490
|
}
|
|
568
491
|
var fromCharCode = String.fromCharCode;
|
|
569
492
|
var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
570
493
|
var b64tab = {};
|
|
571
|
-
for (var
|
|
572
|
-
b64tab[b64chars.charAt(
|
|
494
|
+
for (var i = 0, l = b64chars.length; i < l; i++) {
|
|
495
|
+
b64tab[b64chars.charAt(i)] = i;
|
|
573
496
|
}
|
|
574
497
|
var cb_utob = function (c) {
|
|
575
498
|
var cc = c.charCodeAt(0);
|
|
@@ -602,7 +525,7 @@ var btoa = self.btoa ||
|
|
|
602
525
|
return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
|
603
526
|
};
|
|
604
527
|
|
|
605
|
-
|
|
528
|
+
;// ./src/core/utils/timers/abstract_timer.ts
|
|
606
529
|
class Timer {
|
|
607
530
|
constructor(set, clear, delay, callback) {
|
|
608
531
|
this.clear = clear;
|
|
@@ -622,9 +545,9 @@ class Timer {
|
|
|
622
545
|
}
|
|
623
546
|
}
|
|
624
547
|
}
|
|
625
|
-
/* harmony default export */
|
|
548
|
+
/* harmony default export */ const abstract_timer = (Timer);
|
|
626
549
|
|
|
627
|
-
|
|
550
|
+
;// ./src/core/utils/timers/index.ts
|
|
628
551
|
|
|
629
552
|
function timers_clearTimeout(timer) {
|
|
630
553
|
self.clearTimeout(timer);
|
|
@@ -632,7 +555,7 @@ function timers_clearTimeout(timer) {
|
|
|
632
555
|
function timers_clearInterval(timer) {
|
|
633
556
|
self.clearInterval(timer);
|
|
634
557
|
}
|
|
635
|
-
class
|
|
558
|
+
class OneOffTimer extends abstract_timer {
|
|
636
559
|
constructor(delay, callback) {
|
|
637
560
|
super(setTimeout, timers_clearTimeout, delay, function (timer) {
|
|
638
561
|
callback();
|
|
@@ -640,7 +563,7 @@ class timers_OneOffTimer extends abstract_timer {
|
|
|
640
563
|
});
|
|
641
564
|
}
|
|
642
565
|
}
|
|
643
|
-
class
|
|
566
|
+
class PeriodicTimer extends abstract_timer {
|
|
644
567
|
constructor(delay, callback) {
|
|
645
568
|
super(setInterval, timers_clearInterval, delay, function (timer) {
|
|
646
569
|
callback();
|
|
@@ -649,7 +572,7 @@ class timers_PeriodicTimer extends abstract_timer {
|
|
|
649
572
|
}
|
|
650
573
|
}
|
|
651
574
|
|
|
652
|
-
|
|
575
|
+
;// ./src/core/util.ts
|
|
653
576
|
|
|
654
577
|
var Util = {
|
|
655
578
|
now() {
|
|
@@ -661,7 +584,7 @@ var Util = {
|
|
|
661
584
|
}
|
|
662
585
|
},
|
|
663
586
|
defer(callback) {
|
|
664
|
-
return new
|
|
587
|
+
return new OneOffTimer(0, callback);
|
|
665
588
|
},
|
|
666
589
|
method(name, ...args) {
|
|
667
590
|
var boundArguments = Array.prototype.slice.call(arguments, 1);
|
|
@@ -670,9 +593,9 @@ var Util = {
|
|
|
670
593
|
};
|
|
671
594
|
},
|
|
672
595
|
};
|
|
673
|
-
/* harmony default export */
|
|
596
|
+
/* harmony default export */ const util = (Util);
|
|
674
597
|
|
|
675
|
-
|
|
598
|
+
;// ./src/core/utils/collections.ts
|
|
676
599
|
|
|
677
600
|
|
|
678
601
|
function extend(target, ...sources) {
|
|
@@ -866,9 +789,9 @@ function safeJSONStringify(source) {
|
|
|
866
789
|
}
|
|
867
790
|
}
|
|
868
791
|
|
|
869
|
-
|
|
792
|
+
;// ./src/core/defaults.ts
|
|
870
793
|
var Defaults = {
|
|
871
|
-
VERSION: "8.
|
|
794
|
+
VERSION: "8.5.0",
|
|
872
795
|
PROTOCOL: 7,
|
|
873
796
|
wsPort: 80,
|
|
874
797
|
wssPort: 443,
|
|
@@ -895,9 +818,9 @@ var Defaults = {
|
|
|
895
818
|
cdn_https: "https://js.pusher.com",
|
|
896
819
|
dependency_suffix: "",
|
|
897
820
|
};
|
|
898
|
-
/* harmony default export */
|
|
821
|
+
/* harmony default export */ const defaults = (Defaults);
|
|
899
822
|
|
|
900
|
-
|
|
823
|
+
;// ./src/core/transports/url_schemes.ts
|
|
901
824
|
|
|
902
825
|
function getGenericURL(baseScheme, params, path) {
|
|
903
826
|
var scheme = baseScheme + (params.useTLS ? 's' : '');
|
|
@@ -935,9 +858,9 @@ var sockjs = {
|
|
|
935
858
|
},
|
|
936
859
|
};
|
|
937
860
|
|
|
938
|
-
|
|
861
|
+
;// ./src/core/events/callback_registry.ts
|
|
939
862
|
|
|
940
|
-
class
|
|
863
|
+
class CallbackRegistry {
|
|
941
864
|
constructor() {
|
|
942
865
|
this._callbacks = {};
|
|
943
866
|
}
|
|
@@ -987,12 +910,12 @@ function prefix(name) {
|
|
|
987
910
|
return '_' + name;
|
|
988
911
|
}
|
|
989
912
|
|
|
990
|
-
|
|
913
|
+
;// ./src/core/events/dispatcher.ts
|
|
991
914
|
|
|
992
915
|
|
|
993
|
-
class
|
|
916
|
+
class Dispatcher {
|
|
994
917
|
constructor(failThrough) {
|
|
995
|
-
this.callbacks = new
|
|
918
|
+
this.callbacks = new CallbackRegistry();
|
|
996
919
|
this.global_callbacks = [];
|
|
997
920
|
this.failThrough = failThrough;
|
|
998
921
|
}
|
|
@@ -1045,10 +968,10 @@ class dispatcher_Dispatcher {
|
|
|
1045
968
|
}
|
|
1046
969
|
}
|
|
1047
970
|
|
|
1048
|
-
|
|
971
|
+
;// ./src/core/logger.ts
|
|
1049
972
|
|
|
1050
973
|
|
|
1051
|
-
class
|
|
974
|
+
class Logger {
|
|
1052
975
|
constructor() {
|
|
1053
976
|
this.globalLog = (message) => {
|
|
1054
977
|
if (self.console && self.console.log) {
|
|
@@ -1083,24 +1006,24 @@ class logger_Logger {
|
|
|
1083
1006
|
}
|
|
1084
1007
|
log(defaultLoggingFunction, ...args) {
|
|
1085
1008
|
var message = stringify.apply(this, arguments);
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1009
|
+
if (pusher.log) {
|
|
1010
|
+
pusher.log(message);
|
|
1088
1011
|
}
|
|
1089
|
-
else if (
|
|
1012
|
+
else if (pusher.logToConsole) {
|
|
1090
1013
|
const log = defaultLoggingFunction.bind(this);
|
|
1091
1014
|
log(message);
|
|
1092
1015
|
}
|
|
1093
1016
|
}
|
|
1094
1017
|
}
|
|
1095
|
-
/* harmony default export */
|
|
1018
|
+
/* harmony default export */ const logger = (new Logger());
|
|
1096
1019
|
|
|
1097
|
-
|
|
1020
|
+
;// ./src/core/transports/transport_connection.ts
|
|
1098
1021
|
|
|
1099
1022
|
|
|
1100
1023
|
|
|
1101
1024
|
|
|
1102
1025
|
|
|
1103
|
-
class
|
|
1026
|
+
class TransportConnection extends Dispatcher {
|
|
1104
1027
|
constructor(hooks, name, priority, key, options) {
|
|
1105
1028
|
super();
|
|
1106
1029
|
this.initialize = worker_runtime.transportConnectionInitializer;
|
|
@@ -1241,9 +1164,9 @@ class transport_connection_TransportConnection extends dispatcher_Dispatcher {
|
|
|
1241
1164
|
}
|
|
1242
1165
|
}
|
|
1243
1166
|
|
|
1244
|
-
|
|
1167
|
+
;// ./src/core/transports/transport.ts
|
|
1245
1168
|
|
|
1246
|
-
class
|
|
1169
|
+
class Transport {
|
|
1247
1170
|
constructor(hooks) {
|
|
1248
1171
|
this.hooks = hooks;
|
|
1249
1172
|
}
|
|
@@ -1251,16 +1174,16 @@ class transport_Transport {
|
|
|
1251
1174
|
return this.hooks.isSupported(environment);
|
|
1252
1175
|
}
|
|
1253
1176
|
createConnection(name, priority, key, options) {
|
|
1254
|
-
return new
|
|
1177
|
+
return new TransportConnection(this.hooks, name, priority, key, options);
|
|
1255
1178
|
}
|
|
1256
1179
|
}
|
|
1257
1180
|
|
|
1258
|
-
|
|
1181
|
+
;// ./src/runtimes/isomorphic/transports/transports.ts
|
|
1259
1182
|
|
|
1260
1183
|
|
|
1261
1184
|
|
|
1262
1185
|
|
|
1263
|
-
var WSTransport = new
|
|
1186
|
+
var WSTransport = new Transport({
|
|
1264
1187
|
urls: ws,
|
|
1265
1188
|
handlesActivityChecks: false,
|
|
1266
1189
|
supportsPing: false,
|
|
@@ -1297,19 +1220,19 @@ var xhrConfiguration = {
|
|
|
1297
1220
|
return worker_runtime.isXHRSupported();
|
|
1298
1221
|
},
|
|
1299
1222
|
};
|
|
1300
|
-
var XHRStreamingTransport = new
|
|
1301
|
-
var XHRPollingTransport = new
|
|
1223
|
+
var XHRStreamingTransport = new Transport((extend({}, streamingConfiguration, xhrConfiguration)));
|
|
1224
|
+
var XHRPollingTransport = new Transport((extend({}, pollingConfiguration, xhrConfiguration)));
|
|
1302
1225
|
var Transports = {
|
|
1303
1226
|
ws: WSTransport,
|
|
1304
1227
|
xhr_streaming: XHRStreamingTransport,
|
|
1305
1228
|
xhr_polling: XHRPollingTransport,
|
|
1306
1229
|
};
|
|
1307
|
-
/* harmony default export */
|
|
1230
|
+
/* harmony default export */ const transports = (Transports);
|
|
1308
1231
|
|
|
1309
|
-
|
|
1232
|
+
;// ./src/core/transports/assistant_to_the_transport_manager.ts
|
|
1310
1233
|
|
|
1311
1234
|
|
|
1312
|
-
class
|
|
1235
|
+
class AssistantToTheTransportManager {
|
|
1313
1236
|
constructor(manager, transport, options) {
|
|
1314
1237
|
this.manager = manager;
|
|
1315
1238
|
this.transport = transport;
|
|
@@ -1349,7 +1272,7 @@ class assistant_to_the_transport_manager_AssistantToTheTransportManager {
|
|
|
1349
1272
|
}
|
|
1350
1273
|
}
|
|
1351
1274
|
|
|
1352
|
-
|
|
1275
|
+
;// ./src/core/connection/protocol/protocol.ts
|
|
1353
1276
|
const Protocol = {
|
|
1354
1277
|
decodeMessage: function (messageEvent) {
|
|
1355
1278
|
try {
|
|
@@ -1440,14 +1363,14 @@ const Protocol = {
|
|
|
1440
1363
|
}
|
|
1441
1364
|
},
|
|
1442
1365
|
};
|
|
1443
|
-
/* harmony default export */
|
|
1366
|
+
/* harmony default export */ const protocol = (Protocol);
|
|
1444
1367
|
|
|
1445
|
-
|
|
1368
|
+
;// ./src/core/connection/connection.ts
|
|
1446
1369
|
|
|
1447
1370
|
|
|
1448
1371
|
|
|
1449
1372
|
|
|
1450
|
-
class
|
|
1373
|
+
class Connection extends Dispatcher {
|
|
1451
1374
|
constructor(id, transport) {
|
|
1452
1375
|
super();
|
|
1453
1376
|
this.id = id;
|
|
@@ -1549,11 +1472,11 @@ class connection_Connection extends dispatcher_Dispatcher {
|
|
|
1549
1472
|
}
|
|
1550
1473
|
}
|
|
1551
1474
|
|
|
1552
|
-
|
|
1475
|
+
;// ./src/core/connection/handshake/index.ts
|
|
1553
1476
|
|
|
1554
1477
|
|
|
1555
1478
|
|
|
1556
|
-
class
|
|
1479
|
+
class Handshake {
|
|
1557
1480
|
constructor(transport, callback) {
|
|
1558
1481
|
this.transport = transport;
|
|
1559
1482
|
this.callback = callback;
|
|
@@ -1577,7 +1500,7 @@ class handshake_Handshake {
|
|
|
1577
1500
|
}
|
|
1578
1501
|
if (result.action === 'connected') {
|
|
1579
1502
|
this.finish('connected', {
|
|
1580
|
-
connection: new
|
|
1503
|
+
connection: new Connection(result.id, this.transport),
|
|
1581
1504
|
activityTimeout: result.activityTimeout,
|
|
1582
1505
|
});
|
|
1583
1506
|
}
|
|
@@ -1604,9 +1527,9 @@ class handshake_Handshake {
|
|
|
1604
1527
|
}
|
|
1605
1528
|
}
|
|
1606
1529
|
|
|
1607
|
-
|
|
1530
|
+
;// ./src/core/timeline/timeline_sender.ts
|
|
1608
1531
|
|
|
1609
|
-
class
|
|
1532
|
+
class TimelineSender {
|
|
1610
1533
|
constructor(timeline, options) {
|
|
1611
1534
|
this.timeline = timeline;
|
|
1612
1535
|
this.options = options || {};
|
|
@@ -1619,7 +1542,7 @@ class timeline_sender_TimelineSender {
|
|
|
1619
1542
|
}
|
|
1620
1543
|
}
|
|
1621
1544
|
|
|
1622
|
-
|
|
1545
|
+
;// ./src/core/errors.ts
|
|
1623
1546
|
class BadEventName extends Error {
|
|
1624
1547
|
constructor(msg) {
|
|
1625
1548
|
super(msg);
|
|
@@ -1676,7 +1599,7 @@ class HTTPAuthError extends Error {
|
|
|
1676
1599
|
}
|
|
1677
1600
|
}
|
|
1678
1601
|
|
|
1679
|
-
|
|
1602
|
+
;// ./src/core/utils/url_store.ts
|
|
1680
1603
|
const urlStore = {
|
|
1681
1604
|
baseUrl: 'https://pusher.com',
|
|
1682
1605
|
urls: {
|
|
@@ -1713,15 +1636,15 @@ const buildLogSuffix = function (key) {
|
|
|
1713
1636
|
return '';
|
|
1714
1637
|
return `${urlPrefix} ${url}`;
|
|
1715
1638
|
};
|
|
1716
|
-
/* harmony default export */
|
|
1639
|
+
/* harmony default export */ const url_store = ({ buildLogSuffix });
|
|
1717
1640
|
|
|
1718
|
-
|
|
1641
|
+
;// ./src/core/channels/channel.ts
|
|
1719
1642
|
|
|
1720
1643
|
|
|
1721
1644
|
|
|
1722
1645
|
|
|
1723
1646
|
|
|
1724
|
-
class
|
|
1647
|
+
class Channel extends Dispatcher {
|
|
1725
1648
|
constructor(name, pusher) {
|
|
1726
1649
|
super(function (event, data) {
|
|
1727
1650
|
logger.debug('No callbacks on ' + name + ' for ' + event);
|
|
@@ -1817,9 +1740,9 @@ class channel_Channel extends dispatcher_Dispatcher {
|
|
|
1817
1740
|
}
|
|
1818
1741
|
}
|
|
1819
1742
|
|
|
1820
|
-
|
|
1743
|
+
;// ./src/core/channels/private_channel.ts
|
|
1821
1744
|
|
|
1822
|
-
class
|
|
1745
|
+
class PrivateChannel extends Channel {
|
|
1823
1746
|
authorize(socketId, callback) {
|
|
1824
1747
|
return this.pusher.config.channelAuthorizer({
|
|
1825
1748
|
channelName: this.name,
|
|
@@ -1828,9 +1751,9 @@ class private_channel_PrivateChannel extends channel_Channel {
|
|
|
1828
1751
|
}
|
|
1829
1752
|
}
|
|
1830
1753
|
|
|
1831
|
-
|
|
1754
|
+
;// ./src/core/channels/members.ts
|
|
1832
1755
|
|
|
1833
|
-
class
|
|
1756
|
+
class Members {
|
|
1834
1757
|
constructor() {
|
|
1835
1758
|
this.reset();
|
|
1836
1759
|
}
|
|
@@ -1881,7 +1804,7 @@ class members_Members {
|
|
|
1881
1804
|
}
|
|
1882
1805
|
}
|
|
1883
1806
|
|
|
1884
|
-
|
|
1807
|
+
;// ./src/core/channels/presence_channel.ts
|
|
1885
1808
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1886
1809
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1887
1810
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1895,10 +1818,10 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
1895
1818
|
|
|
1896
1819
|
|
|
1897
1820
|
|
|
1898
|
-
class
|
|
1821
|
+
class PresenceChannel extends PrivateChannel {
|
|
1899
1822
|
constructor(name, pusher) {
|
|
1900
1823
|
super(name, pusher);
|
|
1901
|
-
this.members = new
|
|
1824
|
+
this.members = new Members();
|
|
1902
1825
|
}
|
|
1903
1826
|
authorize(socketId, callback) {
|
|
1904
1827
|
super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1980,18 +1903,16 @@ class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
|
|
|
1980
1903
|
}
|
|
1981
1904
|
|
|
1982
1905
|
// EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
|
|
1983
|
-
var utf8 = __webpack_require__(
|
|
1984
|
-
|
|
1906
|
+
var utf8 = __webpack_require__(978);
|
|
1985
1907
|
// EXTERNAL MODULE: ./node_modules/@stablelib/base64/lib/base64.js
|
|
1986
|
-
var base64 = __webpack_require__(
|
|
1908
|
+
var base64 = __webpack_require__(594);
|
|
1909
|
+
;// ./src/core/channels/encrypted_channel.ts
|
|
1987
1910
|
|
|
1988
|
-
// CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
|
|
1989
1911
|
|
|
1990
1912
|
|
|
1991
1913
|
|
|
1992
1914
|
|
|
1993
|
-
|
|
1994
|
-
class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
|
|
1915
|
+
class EncryptedChannel extends PrivateChannel {
|
|
1995
1916
|
constructor(name, pusher, nacl) {
|
|
1996
1917
|
super(name, pusher);
|
|
1997
1918
|
this.key = null;
|
|
@@ -2008,7 +1929,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2008
1929
|
callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2009
1930
|
return;
|
|
2010
1931
|
}
|
|
2011
|
-
this.key =
|
|
1932
|
+
this.key = (0,base64.decode)(sharedSecret);
|
|
2012
1933
|
delete authData['shared_secret'];
|
|
2013
1934
|
callback(null, authData);
|
|
2014
1935
|
});
|
|
@@ -2036,12 +1957,12 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2036
1957
|
data);
|
|
2037
1958
|
return;
|
|
2038
1959
|
}
|
|
2039
|
-
let cipherText =
|
|
1960
|
+
let cipherText = (0,base64.decode)(data.ciphertext);
|
|
2040
1961
|
if (cipherText.length < this.nacl.secretbox.overheadLength) {
|
|
2041
1962
|
logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
|
|
2042
1963
|
return;
|
|
2043
1964
|
}
|
|
2044
|
-
let nonce =
|
|
1965
|
+
let nonce = (0,base64.decode)(data.nonce);
|
|
2045
1966
|
if (nonce.length < this.nacl.secretbox.nonceLength) {
|
|
2046
1967
|
logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
|
|
2047
1968
|
return;
|
|
@@ -2067,7 +1988,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2067
1988
|
this.emit(event, this.getDataToEmit(bytes));
|
|
2068
1989
|
}
|
|
2069
1990
|
getDataToEmit(bytes) {
|
|
2070
|
-
let raw =
|
|
1991
|
+
let raw = (0,utf8/* decode */.D4)(bytes);
|
|
2071
1992
|
try {
|
|
2072
1993
|
return JSON.parse(raw);
|
|
2073
1994
|
}
|
|
@@ -2077,13 +1998,13 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2077
1998
|
}
|
|
2078
1999
|
}
|
|
2079
2000
|
|
|
2080
|
-
|
|
2001
|
+
;// ./src/core/connection/connection_manager.ts
|
|
2081
2002
|
|
|
2082
2003
|
|
|
2083
2004
|
|
|
2084
2005
|
|
|
2085
2006
|
|
|
2086
|
-
class
|
|
2007
|
+
class ConnectionManager extends Dispatcher {
|
|
2087
2008
|
constructor(key, options) {
|
|
2088
2009
|
super();
|
|
2089
2010
|
this.state = 'initialized';
|
|
@@ -2110,6 +2031,11 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2110
2031
|
});
|
|
2111
2032
|
this.updateStrategy();
|
|
2112
2033
|
}
|
|
2034
|
+
switchCluster(key) {
|
|
2035
|
+
this.key = key;
|
|
2036
|
+
this.updateStrategy();
|
|
2037
|
+
this.retryIn(0);
|
|
2038
|
+
}
|
|
2113
2039
|
connect() {
|
|
2114
2040
|
if (this.connection || this.runner) {
|
|
2115
2041
|
return;
|
|
@@ -2193,7 +2119,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2193
2119
|
if (delay > 0) {
|
|
2194
2120
|
this.emit('connecting_in', Math.round(delay / 1000));
|
|
2195
2121
|
}
|
|
2196
|
-
this.retryTimer = new
|
|
2122
|
+
this.retryTimer = new OneOffTimer(delay || 0, () => {
|
|
2197
2123
|
this.disconnectInternally();
|
|
2198
2124
|
this.connect();
|
|
2199
2125
|
});
|
|
@@ -2205,7 +2131,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2205
2131
|
}
|
|
2206
2132
|
}
|
|
2207
2133
|
setUnavailableTimer() {
|
|
2208
|
-
this.unavailableTimer = new
|
|
2134
|
+
this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, () => {
|
|
2209
2135
|
this.updateState('unavailable');
|
|
2210
2136
|
});
|
|
2211
2137
|
}
|
|
@@ -2217,7 +2143,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2217
2143
|
sendActivityCheck() {
|
|
2218
2144
|
this.stopActivityCheck();
|
|
2219
2145
|
this.connection.ping();
|
|
2220
|
-
this.activityTimer = new
|
|
2146
|
+
this.activityTimer = new OneOffTimer(this.options.pongTimeout, () => {
|
|
2221
2147
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout });
|
|
2222
2148
|
this.retryIn(0);
|
|
2223
2149
|
});
|
|
@@ -2225,7 +2151,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2225
2151
|
resetActivityCheck() {
|
|
2226
2152
|
this.stopActivityCheck();
|
|
2227
2153
|
if (this.connection && !this.connection.handlesActivityChecks()) {
|
|
2228
|
-
this.activityTimer = new
|
|
2154
|
+
this.activityTimer = new OneOffTimer(this.activityTimeout, () => {
|
|
2229
2155
|
this.sendActivityCheck();
|
|
2230
2156
|
});
|
|
2231
2157
|
}
|
|
@@ -2333,12 +2259,12 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2333
2259
|
}
|
|
2334
2260
|
}
|
|
2335
2261
|
|
|
2336
|
-
|
|
2262
|
+
;// ./src/core/channels/channels.ts
|
|
2337
2263
|
|
|
2338
2264
|
|
|
2339
2265
|
|
|
2340
2266
|
|
|
2341
|
-
class
|
|
2267
|
+
class Channels {
|
|
2342
2268
|
constructor() {
|
|
2343
2269
|
this.channels = {};
|
|
2344
2270
|
}
|
|
@@ -2388,7 +2314,7 @@ function createChannel(name, pusher) {
|
|
|
2388
2314
|
}
|
|
2389
2315
|
}
|
|
2390
2316
|
|
|
2391
|
-
|
|
2317
|
+
;// ./src/core/utils/factory.ts
|
|
2392
2318
|
|
|
2393
2319
|
|
|
2394
2320
|
|
|
@@ -2400,38 +2326,38 @@ function createChannel(name, pusher) {
|
|
|
2400
2326
|
|
|
2401
2327
|
var Factory = {
|
|
2402
2328
|
createChannels() {
|
|
2403
|
-
return new
|
|
2329
|
+
return new Channels();
|
|
2404
2330
|
},
|
|
2405
2331
|
createConnectionManager(key, options) {
|
|
2406
|
-
return new
|
|
2332
|
+
return new ConnectionManager(key, options);
|
|
2407
2333
|
},
|
|
2408
2334
|
createChannel(name, pusher) {
|
|
2409
|
-
return new
|
|
2335
|
+
return new Channel(name, pusher);
|
|
2410
2336
|
},
|
|
2411
2337
|
createPrivateChannel(name, pusher) {
|
|
2412
|
-
return new
|
|
2338
|
+
return new PrivateChannel(name, pusher);
|
|
2413
2339
|
},
|
|
2414
2340
|
createPresenceChannel(name, pusher) {
|
|
2415
|
-
return new
|
|
2341
|
+
return new PresenceChannel(name, pusher);
|
|
2416
2342
|
},
|
|
2417
2343
|
createEncryptedChannel(name, pusher, nacl) {
|
|
2418
|
-
return new
|
|
2344
|
+
return new EncryptedChannel(name, pusher, nacl);
|
|
2419
2345
|
},
|
|
2420
2346
|
createTimelineSender(timeline, options) {
|
|
2421
|
-
return new
|
|
2347
|
+
return new TimelineSender(timeline, options);
|
|
2422
2348
|
},
|
|
2423
2349
|
createHandshake(transport, callback) {
|
|
2424
|
-
return new
|
|
2350
|
+
return new Handshake(transport, callback);
|
|
2425
2351
|
},
|
|
2426
2352
|
createAssistantToTheTransportManager(manager, transport, options) {
|
|
2427
|
-
return new
|
|
2353
|
+
return new AssistantToTheTransportManager(manager, transport, options);
|
|
2428
2354
|
},
|
|
2429
2355
|
};
|
|
2430
|
-
/* harmony default export */
|
|
2356
|
+
/* harmony default export */ const factory = (Factory);
|
|
2431
2357
|
|
|
2432
|
-
|
|
2358
|
+
;// ./src/core/transports/transport_manager.ts
|
|
2433
2359
|
|
|
2434
|
-
class
|
|
2360
|
+
class TransportManager {
|
|
2435
2361
|
constructor(options) {
|
|
2436
2362
|
this.options = options || {};
|
|
2437
2363
|
this.livesLeft = this.options.lives || Infinity;
|
|
@@ -2450,11 +2376,11 @@ class transport_manager_TransportManager {
|
|
|
2450
2376
|
}
|
|
2451
2377
|
}
|
|
2452
2378
|
|
|
2453
|
-
|
|
2379
|
+
;// ./src/core/strategies/sequential_strategy.ts
|
|
2454
2380
|
|
|
2455
2381
|
|
|
2456
2382
|
|
|
2457
|
-
class
|
|
2383
|
+
class SequentialStrategy {
|
|
2458
2384
|
constructor(strategies, options) {
|
|
2459
2385
|
this.strategies = strategies;
|
|
2460
2386
|
this.loop = Boolean(options.loop);
|
|
@@ -2510,7 +2436,7 @@ class sequential_strategy_SequentialStrategy {
|
|
|
2510
2436
|
var timer = null;
|
|
2511
2437
|
var runner = null;
|
|
2512
2438
|
if (options.timeout > 0) {
|
|
2513
|
-
timer = new
|
|
2439
|
+
timer = new OneOffTimer(options.timeout, function () {
|
|
2514
2440
|
runner.abort();
|
|
2515
2441
|
callback(true);
|
|
2516
2442
|
});
|
|
@@ -2538,10 +2464,10 @@ class sequential_strategy_SequentialStrategy {
|
|
|
2538
2464
|
}
|
|
2539
2465
|
}
|
|
2540
2466
|
|
|
2541
|
-
|
|
2467
|
+
;// ./src/core/strategies/best_connected_ever_strategy.ts
|
|
2542
2468
|
|
|
2543
2469
|
|
|
2544
|
-
class
|
|
2470
|
+
class BestConnectedEverStrategy {
|
|
2545
2471
|
constructor(strategies) {
|
|
2546
2472
|
this.strategies = strategies;
|
|
2547
2473
|
}
|
|
@@ -2593,12 +2519,12 @@ function abortRunner(runner) {
|
|
|
2593
2519
|
}
|
|
2594
2520
|
}
|
|
2595
2521
|
|
|
2596
|
-
|
|
2522
|
+
;// ./src/core/strategies/websocket_prioritized_cached_strategy.ts
|
|
2597
2523
|
|
|
2598
2524
|
|
|
2599
2525
|
|
|
2600
2526
|
|
|
2601
|
-
class
|
|
2527
|
+
class WebSocketPrioritizedCachedStrategy {
|
|
2602
2528
|
constructor(strategy, transports, options) {
|
|
2603
2529
|
this.strategy = strategy;
|
|
2604
2530
|
this.transports = transports;
|
|
@@ -2623,7 +2549,7 @@ class websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy {
|
|
|
2623
2549
|
transport: info.transport,
|
|
2624
2550
|
latency: info.latency,
|
|
2625
2551
|
});
|
|
2626
|
-
strategies.push(new
|
|
2552
|
+
strategies.push(new SequentialStrategy([transport], {
|
|
2627
2553
|
timeout: info.latency * 2 + 1000,
|
|
2628
2554
|
failFast: true,
|
|
2629
2555
|
}));
|
|
@@ -2709,9 +2635,9 @@ function flushTransportCache(usingTLS) {
|
|
|
2709
2635
|
}
|
|
2710
2636
|
}
|
|
2711
2637
|
|
|
2712
|
-
|
|
2638
|
+
;// ./src/core/strategies/delayed_strategy.ts
|
|
2713
2639
|
|
|
2714
|
-
class
|
|
2640
|
+
class DelayedStrategy {
|
|
2715
2641
|
constructor(strategy, { delay: number }) {
|
|
2716
2642
|
this.strategy = strategy;
|
|
2717
2643
|
this.options = { delay: number };
|
|
@@ -2722,7 +2648,7 @@ class delayed_strategy_DelayedStrategy {
|
|
|
2722
2648
|
connect(minPriority, callback) {
|
|
2723
2649
|
var strategy = this.strategy;
|
|
2724
2650
|
var runner;
|
|
2725
|
-
var timer = new
|
|
2651
|
+
var timer = new OneOffTimer(this.options.delay, function () {
|
|
2726
2652
|
runner = strategy.connect(minPriority, callback);
|
|
2727
2653
|
});
|
|
2728
2654
|
return {
|
|
@@ -2742,7 +2668,7 @@ class delayed_strategy_DelayedStrategy {
|
|
|
2742
2668
|
}
|
|
2743
2669
|
}
|
|
2744
2670
|
|
|
2745
|
-
|
|
2671
|
+
;// ./src/core/strategies/if_strategy.ts
|
|
2746
2672
|
class IfStrategy {
|
|
2747
2673
|
constructor(test, trueBranch, falseBranch) {
|
|
2748
2674
|
this.test = test;
|
|
@@ -2759,7 +2685,7 @@ class IfStrategy {
|
|
|
2759
2685
|
}
|
|
2760
2686
|
}
|
|
2761
2687
|
|
|
2762
|
-
|
|
2688
|
+
;// ./src/core/strategies/first_connected_strategy.ts
|
|
2763
2689
|
class FirstConnectedStrategy {
|
|
2764
2690
|
constructor(strategy) {
|
|
2765
2691
|
this.strategy = strategy;
|
|
@@ -2778,7 +2704,7 @@ class FirstConnectedStrategy {
|
|
|
2778
2704
|
}
|
|
2779
2705
|
}
|
|
2780
2706
|
|
|
2781
|
-
|
|
2707
|
+
;// ./src/runtimes/isomorphic/default_strategy.ts
|
|
2782
2708
|
|
|
2783
2709
|
|
|
2784
2710
|
|
|
@@ -2817,11 +2743,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
2817
2743
|
timeout: 15000,
|
|
2818
2744
|
timeoutLimit: 60000,
|
|
2819
2745
|
};
|
|
2820
|
-
var ws_manager = new
|
|
2746
|
+
var ws_manager = new TransportManager({
|
|
2821
2747
|
minPingDelay: 10000,
|
|
2822
2748
|
maxPingDelay: config.activityTimeout,
|
|
2823
2749
|
});
|
|
2824
|
-
var streaming_manager = new
|
|
2750
|
+
var streaming_manager = new TransportManager({
|
|
2825
2751
|
lives: 2,
|
|
2826
2752
|
minPingDelay: 10000,
|
|
2827
2753
|
maxPingDelay: config.activityTimeout,
|
|
@@ -2830,40 +2756,40 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
2830
2756
|
var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager);
|
|
2831
2757
|
var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, http_options, streaming_manager);
|
|
2832
2758
|
var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, http_options);
|
|
2833
|
-
var ws_loop = new
|
|
2834
|
-
var wss_loop = new
|
|
2835
|
-
var streaming_loop = new
|
|
2836
|
-
var polling_loop = new
|
|
2837
|
-
var http_loop = new
|
|
2838
|
-
new IfStrategy(testSupportsStrategy(streaming_loop), new
|
|
2759
|
+
var ws_loop = new SequentialStrategy([ws_transport], timeouts);
|
|
2760
|
+
var wss_loop = new SequentialStrategy([wss_transport], timeouts);
|
|
2761
|
+
var streaming_loop = new SequentialStrategy([xhr_streaming_transport], timeouts);
|
|
2762
|
+
var polling_loop = new SequentialStrategy([xhr_polling_transport], timeouts);
|
|
2763
|
+
var http_loop = new SequentialStrategy([
|
|
2764
|
+
new IfStrategy(testSupportsStrategy(streaming_loop), new BestConnectedEverStrategy([
|
|
2839
2765
|
streaming_loop,
|
|
2840
|
-
new
|
|
2766
|
+
new DelayedStrategy(polling_loop, { delay: 4000 }),
|
|
2841
2767
|
]), polling_loop),
|
|
2842
2768
|
], timeouts);
|
|
2843
2769
|
var wsStrategy;
|
|
2844
2770
|
if (baseOptions.useTLS) {
|
|
2845
|
-
wsStrategy = new
|
|
2771
|
+
wsStrategy = new BestConnectedEverStrategy([
|
|
2846
2772
|
ws_loop,
|
|
2847
|
-
new
|
|
2773
|
+
new DelayedStrategy(http_loop, { delay: 2000 }),
|
|
2848
2774
|
]);
|
|
2849
2775
|
}
|
|
2850
2776
|
else {
|
|
2851
|
-
wsStrategy = new
|
|
2777
|
+
wsStrategy = new BestConnectedEverStrategy([
|
|
2852
2778
|
ws_loop,
|
|
2853
|
-
new
|
|
2854
|
-
new
|
|
2779
|
+
new DelayedStrategy(wss_loop, { delay: 2000 }),
|
|
2780
|
+
new DelayedStrategy(http_loop, { delay: 5000 }),
|
|
2855
2781
|
]);
|
|
2856
2782
|
}
|
|
2857
|
-
return new
|
|
2783
|
+
return new WebSocketPrioritizedCachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
|
|
2858
2784
|
ttl: 1800000,
|
|
2859
2785
|
timeline: baseOptions.timeline,
|
|
2860
2786
|
useTLS: baseOptions.useTLS,
|
|
2861
2787
|
});
|
|
2862
2788
|
};
|
|
2863
|
-
/* harmony default export */
|
|
2789
|
+
/* harmony default export */ const default_strategy = (getDefaultStrategy);
|
|
2864
2790
|
|
|
2865
|
-
|
|
2866
|
-
/* harmony default export */
|
|
2791
|
+
;// ./src/runtimes/isomorphic/transports/transport_connection_initializer.ts
|
|
2792
|
+
/* harmony default export */ function transport_connection_initializer() {
|
|
2867
2793
|
var self = this;
|
|
2868
2794
|
self.timeline.info(self.buildTimelineMessage({
|
|
2869
2795
|
transport: self.name + (self.options.useTLS ? 's' : ''),
|
|
@@ -2874,13 +2800,13 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
2874
2800
|
else {
|
|
2875
2801
|
self.onClose();
|
|
2876
2802
|
}
|
|
2877
|
-
}
|
|
2803
|
+
}
|
|
2878
2804
|
|
|
2879
|
-
|
|
2805
|
+
;// ./src/core/http/http_request.ts
|
|
2880
2806
|
|
|
2881
2807
|
|
|
2882
2808
|
const MAX_BUFFER_LENGTH = 256 * 1024;
|
|
2883
|
-
class
|
|
2809
|
+
class HTTPRequest extends Dispatcher {
|
|
2884
2810
|
constructor(hooks, method, url) {
|
|
2885
2811
|
super();
|
|
2886
2812
|
this.hooks = hooks;
|
|
@@ -2940,21 +2866,21 @@ class http_request_HTTPRequest extends dispatcher_Dispatcher {
|
|
|
2940
2866
|
}
|
|
2941
2867
|
}
|
|
2942
2868
|
|
|
2943
|
-
|
|
2869
|
+
;// ./src/core/http/state.ts
|
|
2944
2870
|
var State;
|
|
2945
2871
|
(function (State) {
|
|
2946
2872
|
State[State["CONNECTING"] = 0] = "CONNECTING";
|
|
2947
2873
|
State[State["OPEN"] = 1] = "OPEN";
|
|
2948
2874
|
State[State["CLOSED"] = 3] = "CLOSED";
|
|
2949
2875
|
})(State || (State = {}));
|
|
2950
|
-
/* harmony default export */
|
|
2876
|
+
/* harmony default export */ const state = (State);
|
|
2951
2877
|
|
|
2952
|
-
|
|
2878
|
+
;// ./src/core/http/http_socket.ts
|
|
2953
2879
|
|
|
2954
2880
|
|
|
2955
2881
|
|
|
2956
2882
|
var autoIncrement = 1;
|
|
2957
|
-
class
|
|
2883
|
+
class HTTPSocket {
|
|
2958
2884
|
constructor(hooks, url) {
|
|
2959
2885
|
this.hooks = hooks;
|
|
2960
2886
|
this.session = randomNumber(1000) + '/' + randomString(8);
|
|
@@ -3119,10 +3045,10 @@ function randomString(length) {
|
|
|
3119
3045
|
}
|
|
3120
3046
|
return result.join('');
|
|
3121
3047
|
}
|
|
3122
|
-
/* harmony default export */
|
|
3048
|
+
/* harmony default export */ const http_socket = (HTTPSocket);
|
|
3123
3049
|
|
|
3124
|
-
|
|
3125
|
-
var
|
|
3050
|
+
;// ./src/core/http/http_streaming_socket.ts
|
|
3051
|
+
var hooks = {
|
|
3126
3052
|
getReceiveURL: function (url, session) {
|
|
3127
3053
|
return url.base + '/' + session + '/xhr_streaming' + url.queryString;
|
|
3128
3054
|
},
|
|
@@ -3136,9 +3062,9 @@ var http_streaming_socket_hooks = {
|
|
|
3136
3062
|
socket.onClose(1006, 'Connection interrupted (' + status + ')', false);
|
|
3137
3063
|
},
|
|
3138
3064
|
};
|
|
3139
|
-
/* harmony default export */
|
|
3065
|
+
/* harmony default export */ const http_streaming_socket = (hooks);
|
|
3140
3066
|
|
|
3141
|
-
|
|
3067
|
+
;// ./src/core/http/http_polling_socket.ts
|
|
3142
3068
|
var http_polling_socket_hooks = {
|
|
3143
3069
|
getReceiveURL: function (url, session) {
|
|
3144
3070
|
return url.base + '/' + session + '/xhr' + url.queryString;
|
|
@@ -3157,9 +3083,9 @@ var http_polling_socket_hooks = {
|
|
|
3157
3083
|
}
|
|
3158
3084
|
},
|
|
3159
3085
|
};
|
|
3160
|
-
/* harmony default export */
|
|
3086
|
+
/* harmony default export */ const http_polling_socket = (http_polling_socket_hooks);
|
|
3161
3087
|
|
|
3162
|
-
|
|
3088
|
+
;// ./src/runtimes/isomorphic/http/http_xhr_request.ts
|
|
3163
3089
|
|
|
3164
3090
|
var http_xhr_request_hooks = {
|
|
3165
3091
|
getRequest: function (socket) {
|
|
@@ -3188,9 +3114,9 @@ var http_xhr_request_hooks = {
|
|
|
3188
3114
|
xhr.abort();
|
|
3189
3115
|
},
|
|
3190
3116
|
};
|
|
3191
|
-
/* harmony default export */
|
|
3117
|
+
/* harmony default export */ const http_xhr_request = (http_xhr_request_hooks);
|
|
3192
3118
|
|
|
3193
|
-
|
|
3119
|
+
;// ./src/runtimes/isomorphic/http/http.ts
|
|
3194
3120
|
|
|
3195
3121
|
|
|
3196
3122
|
|
|
@@ -3210,12 +3136,12 @@ var HTTP = {
|
|
|
3210
3136
|
return this.createRequest(http_xhr_request, method, url);
|
|
3211
3137
|
},
|
|
3212
3138
|
createRequest(hooks, method, url) {
|
|
3213
|
-
return new
|
|
3139
|
+
return new HTTPRequest(hooks, method, url);
|
|
3214
3140
|
},
|
|
3215
3141
|
};
|
|
3216
|
-
/* harmony default export */
|
|
3142
|
+
/* harmony default export */ const http_http = (HTTP);
|
|
3217
3143
|
|
|
3218
|
-
|
|
3144
|
+
;// ./src/runtimes/isomorphic/runtime.ts
|
|
3219
3145
|
|
|
3220
3146
|
|
|
3221
3147
|
|
|
@@ -3262,18 +3188,18 @@ var Isomorphic = {
|
|
|
3262
3188
|
addUnloadListener(listener) { },
|
|
3263
3189
|
removeUnloadListener(listener) { },
|
|
3264
3190
|
};
|
|
3265
|
-
/* harmony default export */
|
|
3191
|
+
/* harmony default export */ const runtime = (Isomorphic);
|
|
3266
3192
|
|
|
3267
|
-
|
|
3193
|
+
;// ./src/runtimes/worker/net_info.ts
|
|
3268
3194
|
|
|
3269
|
-
class
|
|
3195
|
+
class NetInfo extends Dispatcher {
|
|
3270
3196
|
isOnline() {
|
|
3271
3197
|
return true;
|
|
3272
3198
|
}
|
|
3273
3199
|
}
|
|
3274
|
-
var
|
|
3200
|
+
var Network = new NetInfo();
|
|
3275
3201
|
|
|
3276
|
-
|
|
3202
|
+
;// ./src/runtimes/worker/auth/fetch_auth.ts
|
|
3277
3203
|
|
|
3278
3204
|
var fetchAuth = function (context, query, authOptions, authRequestType, callback) {
|
|
3279
3205
|
var headers = new Headers();
|
|
@@ -3316,9 +3242,9 @@ var fetchAuth = function (context, query, authOptions, authRequestType, callback
|
|
|
3316
3242
|
callback(err, null);
|
|
3317
3243
|
});
|
|
3318
3244
|
};
|
|
3319
|
-
/* harmony default export */
|
|
3245
|
+
/* harmony default export */ const fetch_auth = (fetchAuth);
|
|
3320
3246
|
|
|
3321
|
-
|
|
3247
|
+
;// ./src/runtimes/worker/timeline/fetch_timeline.ts
|
|
3322
3248
|
|
|
3323
3249
|
|
|
3324
3250
|
var getAgent = function (sender, useTLS) {
|
|
@@ -3348,9 +3274,9 @@ var fetchTimeline = {
|
|
|
3348
3274
|
name: 'xhr',
|
|
3349
3275
|
getAgent,
|
|
3350
3276
|
};
|
|
3351
|
-
/* harmony default export */
|
|
3277
|
+
/* harmony default export */ const fetch_timeline = (fetchTimeline);
|
|
3352
3278
|
|
|
3353
|
-
|
|
3279
|
+
;// ./src/runtimes/worker/runtime.ts
|
|
3354
3280
|
|
|
3355
3281
|
|
|
3356
3282
|
|
|
@@ -3381,7 +3307,7 @@ const Worker = {
|
|
|
3381
3307
|
return XMLHttpRequest;
|
|
3382
3308
|
},
|
|
3383
3309
|
getNetwork() {
|
|
3384
|
-
return
|
|
3310
|
+
return Network;
|
|
3385
3311
|
},
|
|
3386
3312
|
randomInt(max) {
|
|
3387
3313
|
const random = function () {
|
|
@@ -3392,22 +3318,22 @@ const Worker = {
|
|
|
3392
3318
|
return Math.floor(random() * max);
|
|
3393
3319
|
},
|
|
3394
3320
|
};
|
|
3395
|
-
/* harmony default export */
|
|
3321
|
+
/* harmony default export */ const worker_runtime = (Worker);
|
|
3396
3322
|
|
|
3397
|
-
|
|
3323
|
+
;// ./src/core/timeline/level.ts
|
|
3398
3324
|
var TimelineLevel;
|
|
3399
3325
|
(function (TimelineLevel) {
|
|
3400
3326
|
TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
|
|
3401
3327
|
TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
|
|
3402
3328
|
TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
|
|
3403
3329
|
})(TimelineLevel || (TimelineLevel = {}));
|
|
3404
|
-
/* harmony default export */
|
|
3330
|
+
/* harmony default export */ const level = (TimelineLevel);
|
|
3405
3331
|
|
|
3406
|
-
|
|
3332
|
+
;// ./src/core/timeline/timeline.ts
|
|
3407
3333
|
|
|
3408
3334
|
|
|
3409
3335
|
|
|
3410
|
-
class
|
|
3336
|
+
class Timeline {
|
|
3411
3337
|
constructor(key, session, options) {
|
|
3412
3338
|
this.key = key;
|
|
3413
3339
|
this.session = session;
|
|
@@ -3425,13 +3351,13 @@ class timeline_Timeline {
|
|
|
3425
3351
|
}
|
|
3426
3352
|
}
|
|
3427
3353
|
error(event) {
|
|
3428
|
-
this.log(
|
|
3354
|
+
this.log(level.ERROR, event);
|
|
3429
3355
|
}
|
|
3430
3356
|
info(event) {
|
|
3431
|
-
this.log(
|
|
3357
|
+
this.log(level.INFO, event);
|
|
3432
3358
|
}
|
|
3433
3359
|
debug(event) {
|
|
3434
|
-
this.log(
|
|
3360
|
+
this.log(level.DEBUG, event);
|
|
3435
3361
|
}
|
|
3436
3362
|
isEmpty() {
|
|
3437
3363
|
return this.events.length === 0;
|
|
@@ -3464,12 +3390,12 @@ class timeline_Timeline {
|
|
|
3464
3390
|
}
|
|
3465
3391
|
}
|
|
3466
3392
|
|
|
3467
|
-
|
|
3393
|
+
;// ./src/core/strategies/transport_strategy.ts
|
|
3468
3394
|
|
|
3469
3395
|
|
|
3470
3396
|
|
|
3471
3397
|
|
|
3472
|
-
class
|
|
3398
|
+
class TransportStrategy {
|
|
3473
3399
|
constructor(name, priority, transport, options) {
|
|
3474
3400
|
this.name = name;
|
|
3475
3401
|
this.priority = priority;
|
|
@@ -3562,14 +3488,14 @@ function failAttempt(error, callback) {
|
|
|
3562
3488
|
};
|
|
3563
3489
|
}
|
|
3564
3490
|
|
|
3565
|
-
|
|
3491
|
+
;// ./src/core/strategies/strategy_builder.ts
|
|
3566
3492
|
|
|
3567
3493
|
|
|
3568
3494
|
|
|
3569
3495
|
|
|
3570
3496
|
|
|
3571
3497
|
const { Transports: strategy_builder_Transports } = worker_runtime;
|
|
3572
|
-
var
|
|
3498
|
+
var defineTransport = function (config, name, type, priority, options, manager) {
|
|
3573
3499
|
var transportClass = strategy_builder_Transports[type];
|
|
3574
3500
|
if (!transportClass) {
|
|
3575
3501
|
throw new UnsupportedTransport(type);
|
|
@@ -3581,7 +3507,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
|
|
|
3581
3507
|
var transport;
|
|
3582
3508
|
if (enabled) {
|
|
3583
3509
|
options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
|
|
3584
|
-
transport = new
|
|
3510
|
+
transport = new TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
|
|
3585
3511
|
}
|
|
3586
3512
|
else {
|
|
3587
3513
|
transport = strategy_builder_UnsupportedStrategy;
|
|
@@ -3605,7 +3531,7 @@ var strategy_builder_UnsupportedStrategy = {
|
|
|
3605
3531
|
},
|
|
3606
3532
|
};
|
|
3607
3533
|
|
|
3608
|
-
|
|
3534
|
+
;// ./src/core/options.ts
|
|
3609
3535
|
|
|
3610
3536
|
function validateOptions(options) {
|
|
3611
3537
|
if (options == null) {
|
|
@@ -3619,14 +3545,14 @@ function validateOptions(options) {
|
|
|
3619
3545
|
}
|
|
3620
3546
|
}
|
|
3621
3547
|
|
|
3622
|
-
|
|
3548
|
+
;// ./src/core/auth/options.ts
|
|
3623
3549
|
var AuthRequestType;
|
|
3624
3550
|
(function (AuthRequestType) {
|
|
3625
3551
|
AuthRequestType["UserAuthentication"] = "user-authentication";
|
|
3626
3552
|
AuthRequestType["ChannelAuthorization"] = "channel-authorization";
|
|
3627
3553
|
})(AuthRequestType || (AuthRequestType = {}));
|
|
3628
3554
|
|
|
3629
|
-
|
|
3555
|
+
;// ./src/core/auth/user_authenticator.ts
|
|
3630
3556
|
|
|
3631
3557
|
|
|
3632
3558
|
const composeChannelQuery = (params, authOptions) => {
|
|
@@ -3659,9 +3585,9 @@ const UserAuthenticator = (authOptions) => {
|
|
|
3659
3585
|
worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
|
|
3660
3586
|
};
|
|
3661
3587
|
};
|
|
3662
|
-
/* harmony default export */
|
|
3588
|
+
/* harmony default export */ const user_authenticator = (UserAuthenticator);
|
|
3663
3589
|
|
|
3664
|
-
|
|
3590
|
+
;// ./src/core/auth/channel_authorizer.ts
|
|
3665
3591
|
|
|
3666
3592
|
|
|
3667
3593
|
const channel_authorizer_composeChannelQuery = (params, authOptions) => {
|
|
@@ -3695,9 +3621,9 @@ const ChannelAuthorizer = (authOptions) => {
|
|
|
3695
3621
|
worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
|
|
3696
3622
|
};
|
|
3697
3623
|
};
|
|
3698
|
-
/* harmony default export */
|
|
3624
|
+
/* harmony default export */ const channel_authorizer = (ChannelAuthorizer);
|
|
3699
3625
|
|
|
3700
|
-
|
|
3626
|
+
;// ./src/core/auth/deprecated_channel_authorizer.ts
|
|
3701
3627
|
const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
|
|
3702
3628
|
const deprecatedAuthorizerOptions = {
|
|
3703
3629
|
authTransport: authOptions.transport,
|
|
@@ -3714,7 +3640,7 @@ const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator)
|
|
|
3714
3640
|
};
|
|
3715
3641
|
};
|
|
3716
3642
|
|
|
3717
|
-
|
|
3643
|
+
;// ./src/core/config.ts
|
|
3718
3644
|
|
|
3719
3645
|
|
|
3720
3646
|
|
|
@@ -3789,10 +3715,12 @@ function getEnableStatsConfig(opts) {
|
|
|
3789
3715
|
}
|
|
3790
3716
|
return false;
|
|
3791
3717
|
}
|
|
3718
|
+
const hasCustomHandler = (auth) => {
|
|
3719
|
+
return 'customHandler' in auth && auth['customHandler'] != null;
|
|
3720
|
+
};
|
|
3792
3721
|
function buildUserAuthenticator(opts) {
|
|
3793
3722
|
const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
3794
|
-
if (
|
|
3795
|
-
userAuthentication['customHandler'] != null) {
|
|
3723
|
+
if (hasCustomHandler(userAuthentication)) {
|
|
3796
3724
|
return userAuthentication['customHandler'];
|
|
3797
3725
|
}
|
|
3798
3726
|
return user_authenticator(userAuthentication);
|
|
@@ -3813,24 +3741,26 @@ function buildChannelAuth(opts, pusher) {
|
|
|
3813
3741
|
if ('headers' in opts.auth)
|
|
3814
3742
|
channelAuthorization.headers = opts.auth.headers;
|
|
3815
3743
|
}
|
|
3816
|
-
if ('authorizer' in opts)
|
|
3817
|
-
|
|
3744
|
+
if ('authorizer' in opts) {
|
|
3745
|
+
return {
|
|
3746
|
+
customHandler: ChannelAuthorizerProxy(pusher, channelAuthorization, opts.authorizer),
|
|
3747
|
+
};
|
|
3748
|
+
}
|
|
3818
3749
|
}
|
|
3819
3750
|
return channelAuthorization;
|
|
3820
3751
|
}
|
|
3821
3752
|
function buildChannelAuthorizer(opts, pusher) {
|
|
3822
3753
|
const channelAuthorization = buildChannelAuth(opts, pusher);
|
|
3823
|
-
if (
|
|
3824
|
-
channelAuthorization['customHandler'] != null) {
|
|
3754
|
+
if (hasCustomHandler(channelAuthorization)) {
|
|
3825
3755
|
return channelAuthorization['customHandler'];
|
|
3826
3756
|
}
|
|
3827
3757
|
return channel_authorizer(channelAuthorization);
|
|
3828
3758
|
}
|
|
3829
3759
|
|
|
3830
|
-
|
|
3760
|
+
;// ./src/core/watchlist.ts
|
|
3831
3761
|
|
|
3832
3762
|
|
|
3833
|
-
class
|
|
3763
|
+
class WatchlistFacade extends Dispatcher {
|
|
3834
3764
|
constructor(pusher) {
|
|
3835
3765
|
super(function (eventName, data) {
|
|
3836
3766
|
logger.debug(`No callbacks on watchlist events for ${eventName}`);
|
|
@@ -3853,7 +3783,7 @@ class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
|
|
|
3853
3783
|
}
|
|
3854
3784
|
}
|
|
3855
3785
|
|
|
3856
|
-
|
|
3786
|
+
;// ./src/core/utils/flat_promise.ts
|
|
3857
3787
|
function flatPromise() {
|
|
3858
3788
|
let resolve, reject;
|
|
3859
3789
|
const promise = new Promise((res, rej) => {
|
|
@@ -3862,15 +3792,15 @@ function flatPromise() {
|
|
|
3862
3792
|
});
|
|
3863
3793
|
return { promise, resolve, reject };
|
|
3864
3794
|
}
|
|
3865
|
-
/* harmony default export */
|
|
3795
|
+
/* harmony default export */ const flat_promise = (flatPromise);
|
|
3866
3796
|
|
|
3867
|
-
|
|
3797
|
+
;// ./src/core/user.ts
|
|
3868
3798
|
|
|
3869
3799
|
|
|
3870
3800
|
|
|
3871
3801
|
|
|
3872
3802
|
|
|
3873
|
-
class
|
|
3803
|
+
class UserFacade extends Dispatcher {
|
|
3874
3804
|
constructor(pusher) {
|
|
3875
3805
|
super(function (eventName, data) {
|
|
3876
3806
|
logger.debug('No callbacks on user for ' + eventName);
|
|
@@ -3901,7 +3831,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
3901
3831
|
this._newSigninPromiseIfNeeded();
|
|
3902
3832
|
}
|
|
3903
3833
|
});
|
|
3904
|
-
this.watchlist = new
|
|
3834
|
+
this.watchlist = new WatchlistFacade(pusher);
|
|
3905
3835
|
this.pusher.connection.bind('message', (event) => {
|
|
3906
3836
|
var eventName = event.event;
|
|
3907
3837
|
if (eventName === 'pusher:signin_success') {
|
|
@@ -3959,7 +3889,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
3959
3889
|
channel.subscribe();
|
|
3960
3890
|
}
|
|
3961
3891
|
};
|
|
3962
|
-
this.serverToUserChannel = new
|
|
3892
|
+
this.serverToUserChannel = new Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
|
|
3963
3893
|
this.serverToUserChannel.bind_global((eventName, data) => {
|
|
3964
3894
|
if (eventName.indexOf('pusher_internal:') === 0 ||
|
|
3965
3895
|
eventName.indexOf('pusher:') === 0) {
|
|
@@ -3998,7 +3928,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
3998
3928
|
}
|
|
3999
3929
|
}
|
|
4000
3930
|
|
|
4001
|
-
|
|
3931
|
+
;// ./src/core/pusher.ts
|
|
4002
3932
|
|
|
4003
3933
|
|
|
4004
3934
|
|
|
@@ -4012,11 +3942,11 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
4012
3942
|
|
|
4013
3943
|
|
|
4014
3944
|
|
|
4015
|
-
class
|
|
3945
|
+
class Pusher {
|
|
4016
3946
|
static ready() {
|
|
4017
|
-
|
|
4018
|
-
for (var i = 0, l =
|
|
4019
|
-
|
|
3947
|
+
Pusher.isReady = true;
|
|
3948
|
+
for (var i = 0, l = Pusher.instances.length; i < l; i++) {
|
|
3949
|
+
Pusher.instances[i].connect();
|
|
4020
3950
|
}
|
|
4021
3951
|
}
|
|
4022
3952
|
static getClientFeatures() {
|
|
@@ -4028,16 +3958,17 @@ class pusher_Pusher {
|
|
|
4028
3958
|
checkAppKey(app_key);
|
|
4029
3959
|
validateOptions(options);
|
|
4030
3960
|
this.key = app_key;
|
|
4031
|
-
this.
|
|
3961
|
+
this.options = options;
|
|
3962
|
+
this.config = getConfig(this.options, this);
|
|
4032
3963
|
this.channels = factory.createChannels();
|
|
4033
|
-
this.global_emitter = new
|
|
3964
|
+
this.global_emitter = new Dispatcher();
|
|
4034
3965
|
this.sessionID = worker_runtime.randomInt(1000000000);
|
|
4035
|
-
this.timeline = new
|
|
3966
|
+
this.timeline = new Timeline(this.key, this.sessionID, {
|
|
4036
3967
|
cluster: this.config.cluster,
|
|
4037
|
-
features:
|
|
3968
|
+
features: Pusher.getClientFeatures(),
|
|
4038
3969
|
params: this.config.timelineParams || {},
|
|
4039
3970
|
limit: 50,
|
|
4040
|
-
level:
|
|
3971
|
+
level: level.INFO,
|
|
4041
3972
|
version: defaults.VERSION,
|
|
4042
3973
|
});
|
|
4043
3974
|
if (this.config.enableStats) {
|
|
@@ -4047,7 +3978,7 @@ class pusher_Pusher {
|
|
|
4047
3978
|
});
|
|
4048
3979
|
}
|
|
4049
3980
|
var getStrategy = (options) => {
|
|
4050
|
-
return worker_runtime.getDefaultStrategy(this.config, options,
|
|
3981
|
+
return worker_runtime.getDefaultStrategy(this.config, options, defineTransport);
|
|
4051
3982
|
};
|
|
4052
3983
|
this.connection = factory.createConnectionManager(this.key, {
|
|
4053
3984
|
getStrategy: getStrategy,
|
|
@@ -4085,13 +4016,20 @@ class pusher_Pusher {
|
|
|
4085
4016
|
this.connection.bind('error', (err) => {
|
|
4086
4017
|
logger.warn(err);
|
|
4087
4018
|
});
|
|
4088
|
-
|
|
4089
|
-
this.timeline.info({ instances:
|
|
4090
|
-
this.user = new
|
|
4091
|
-
if (
|
|
4019
|
+
Pusher.instances.push(this);
|
|
4020
|
+
this.timeline.info({ instances: Pusher.instances.length });
|
|
4021
|
+
this.user = new UserFacade(this);
|
|
4022
|
+
if (Pusher.isReady) {
|
|
4092
4023
|
this.connect();
|
|
4093
4024
|
}
|
|
4094
4025
|
}
|
|
4026
|
+
switchCluster(options) {
|
|
4027
|
+
const { appKey, cluster } = options;
|
|
4028
|
+
this.key = appKey;
|
|
4029
|
+
this.options = Object.assign(Object.assign({}, this.options), { cluster });
|
|
4030
|
+
this.config = getConfig(this.options, this);
|
|
4031
|
+
this.connection.switchCluster(this.key);
|
|
4032
|
+
}
|
|
4095
4033
|
channel(name) {
|
|
4096
4034
|
return this.channels.find(name);
|
|
4097
4035
|
}
|
|
@@ -4104,7 +4042,7 @@ class pusher_Pusher {
|
|
|
4104
4042
|
if (!this.timelineSenderTimer) {
|
|
4105
4043
|
var usingTLS = this.connection.isUsingTLS();
|
|
4106
4044
|
var timelineSender = this.timelineSender;
|
|
4107
|
-
this.timelineSenderTimer = new
|
|
4045
|
+
this.timelineSenderTimer = new PeriodicTimer(60000, function () {
|
|
4108
4046
|
timelineSender.send(usingTLS);
|
|
4109
4047
|
});
|
|
4110
4048
|
}
|
|
@@ -4178,23 +4116,77 @@ class pusher_Pusher {
|
|
|
4178
4116
|
this.user.signin();
|
|
4179
4117
|
}
|
|
4180
4118
|
}
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
/* harmony default export */
|
|
4119
|
+
Pusher.instances = [];
|
|
4120
|
+
Pusher.isReady = false;
|
|
4121
|
+
Pusher.logToConsole = false;
|
|
4122
|
+
Pusher.Runtime = worker_runtime;
|
|
4123
|
+
Pusher.ScriptReceivers = worker_runtime.ScriptReceivers;
|
|
4124
|
+
Pusher.DependenciesReceivers = worker_runtime.DependenciesReceivers;
|
|
4125
|
+
Pusher.auth_callbacks = worker_runtime.auth_callbacks;
|
|
4126
|
+
/* harmony default export */ const pusher = (Pusher);
|
|
4189
4127
|
function checkAppKey(key) {
|
|
4190
4128
|
if (key === null || key === undefined) {
|
|
4191
4129
|
throw 'You must pass your app key when you instantiate Pusher.';
|
|
4192
4130
|
}
|
|
4193
4131
|
}
|
|
4194
|
-
worker_runtime.setup(
|
|
4132
|
+
worker_runtime.setup(Pusher);
|
|
4195
4133
|
|
|
4196
4134
|
|
|
4197
|
-
/***/ }
|
|
4198
|
-
|
|
4135
|
+
/***/ }
|
|
4136
|
+
|
|
4137
|
+
/******/ });
|
|
4138
|
+
/************************************************************************/
|
|
4139
|
+
/******/ // The module cache
|
|
4140
|
+
/******/ var __webpack_module_cache__ = {};
|
|
4141
|
+
/******/
|
|
4142
|
+
/******/ // The require function
|
|
4143
|
+
/******/ function __webpack_require__(moduleId) {
|
|
4144
|
+
/******/ // Check if module is in cache
|
|
4145
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
4146
|
+
/******/ if (cachedModule !== undefined) {
|
|
4147
|
+
/******/ return cachedModule.exports;
|
|
4148
|
+
/******/ }
|
|
4149
|
+
/******/ // Create a new module (and put it into the cache)
|
|
4150
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
4151
|
+
/******/ // no module.id needed
|
|
4152
|
+
/******/ // no module.loaded needed
|
|
4153
|
+
/******/ exports: {}
|
|
4154
|
+
/******/ };
|
|
4155
|
+
/******/
|
|
4156
|
+
/******/ // Execute the module function
|
|
4157
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
4158
|
+
/******/
|
|
4159
|
+
/******/ // Return the exports of the module
|
|
4160
|
+
/******/ return module.exports;
|
|
4161
|
+
/******/ }
|
|
4162
|
+
/******/
|
|
4163
|
+
/************************************************************************/
|
|
4164
|
+
/******/ /* webpack/runtime/define property getters */
|
|
4165
|
+
/******/ (() => {
|
|
4166
|
+
/******/ // define getter functions for harmony exports
|
|
4167
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
4168
|
+
/******/ for(var key in definition) {
|
|
4169
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
4170
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
4171
|
+
/******/ }
|
|
4172
|
+
/******/ }
|
|
4173
|
+
/******/ };
|
|
4174
|
+
/******/ })();
|
|
4175
|
+
/******/
|
|
4176
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
4177
|
+
/******/ (() => {
|
|
4178
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
4179
|
+
/******/ })();
|
|
4180
|
+
/******/
|
|
4181
|
+
/************************************************************************/
|
|
4182
|
+
/******/
|
|
4183
|
+
/******/ // startup
|
|
4184
|
+
/******/ // Load entry module and return exports
|
|
4185
|
+
/******/ // This entry module used 'module' so it can't be inlined
|
|
4186
|
+
/******/ var __webpack_exports__ = __webpack_require__(721);
|
|
4187
|
+
/******/
|
|
4188
|
+
/******/ return __webpack_exports__;
|
|
4189
|
+
/******/ })()
|
|
4190
|
+
;
|
|
4199
4191
|
});
|
|
4200
4192
|
//# sourceMappingURL=pusher.worker.js.map
|