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
package/dist/web/pusher.js
CHANGED
|
@@ -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
|
-
})(
|
|
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
|
+
})(self, () => {
|
|
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,26 +460,31 @@ 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__(207)["default"];
|
|
554
473
|
|
|
555
474
|
|
|
556
|
-
/***/ }
|
|
557
|
-
|
|
558
|
-
/***/
|
|
475
|
+
/***/ },
|
|
476
|
+
|
|
477
|
+
/***/ 207
|
|
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/runtimes/web/dom/script_receiver_factory.ts
|
|
565
488
|
class ScriptReceiverFactory {
|
|
566
489
|
constructor(prefix, name) {
|
|
567
490
|
this.lastId = 0;
|
|
@@ -589,9 +512,9 @@ class ScriptReceiverFactory {
|
|
|
589
512
|
}
|
|
590
513
|
var ScriptReceivers = new ScriptReceiverFactory('_pusher_script_', 'Pusher.ScriptReceivers');
|
|
591
514
|
|
|
592
|
-
|
|
515
|
+
;// ./src/core/defaults.ts
|
|
593
516
|
var Defaults = {
|
|
594
|
-
VERSION: "8.
|
|
517
|
+
VERSION: "8.5.0",
|
|
595
518
|
PROTOCOL: 7,
|
|
596
519
|
wsPort: 80,
|
|
597
520
|
wssPort: 443,
|
|
@@ -618,12 +541,12 @@ var Defaults = {
|
|
|
618
541
|
cdn_https: "https://js.pusher.com",
|
|
619
542
|
dependency_suffix: "",
|
|
620
543
|
};
|
|
621
|
-
/* harmony default export */
|
|
544
|
+
/* harmony default export */ const defaults = (Defaults);
|
|
622
545
|
|
|
623
|
-
|
|
546
|
+
;// ./src/runtimes/web/dom/dependency_loader.ts
|
|
624
547
|
|
|
625
548
|
|
|
626
|
-
class
|
|
549
|
+
class DependencyLoader {
|
|
627
550
|
constructor(options) {
|
|
628
551
|
this.options = options;
|
|
629
552
|
this.receivers = options.receivers || ScriptReceivers;
|
|
@@ -671,12 +594,12 @@ class dependency_loader_DependencyLoader {
|
|
|
671
594
|
}
|
|
672
595
|
}
|
|
673
596
|
|
|
674
|
-
|
|
597
|
+
;// ./src/runtimes/web/dom/dependencies.ts
|
|
675
598
|
|
|
676
599
|
|
|
677
600
|
|
|
678
601
|
var DependenciesReceivers = new ScriptReceiverFactory('_pusher_dependencies', 'Pusher.DependenciesReceivers');
|
|
679
|
-
var Dependencies = new
|
|
602
|
+
var Dependencies = new DependencyLoader({
|
|
680
603
|
cdn_http: defaults.cdn_http,
|
|
681
604
|
cdn_https: defaults.cdn_https,
|
|
682
605
|
version: defaults.VERSION,
|
|
@@ -684,7 +607,7 @@ var Dependencies = new dependency_loader_DependencyLoader({
|
|
|
684
607
|
receivers: DependenciesReceivers,
|
|
685
608
|
});
|
|
686
609
|
|
|
687
|
-
|
|
610
|
+
;// ./src/core/utils/url_store.ts
|
|
688
611
|
const urlStore = {
|
|
689
612
|
baseUrl: 'https://pusher.com',
|
|
690
613
|
urls: {
|
|
@@ -721,16 +644,16 @@ const buildLogSuffix = function (key) {
|
|
|
721
644
|
return '';
|
|
722
645
|
return `${urlPrefix} ${url}`;
|
|
723
646
|
};
|
|
724
|
-
/* harmony default export */
|
|
647
|
+
/* harmony default export */ const url_store = ({ buildLogSuffix });
|
|
725
648
|
|
|
726
|
-
|
|
649
|
+
;// ./src/core/auth/options.ts
|
|
727
650
|
var AuthRequestType;
|
|
728
651
|
(function (AuthRequestType) {
|
|
729
652
|
AuthRequestType["UserAuthentication"] = "user-authentication";
|
|
730
653
|
AuthRequestType["ChannelAuthorization"] = "channel-authorization";
|
|
731
654
|
})(AuthRequestType || (AuthRequestType = {}));
|
|
732
655
|
|
|
733
|
-
|
|
656
|
+
;// ./src/core/errors.ts
|
|
734
657
|
class BadEventName extends Error {
|
|
735
658
|
constructor(msg) {
|
|
736
659
|
super(msg);
|
|
@@ -787,7 +710,7 @@ class HTTPAuthError extends Error {
|
|
|
787
710
|
}
|
|
788
711
|
}
|
|
789
712
|
|
|
790
|
-
|
|
713
|
+
;// ./src/runtimes/isomorphic/auth/xhr_auth.ts
|
|
791
714
|
|
|
792
715
|
|
|
793
716
|
|
|
@@ -839,17 +762,17 @@ const ajax = function (context, query, authOptions, authRequestType, callback) {
|
|
|
839
762
|
xhr.send(query);
|
|
840
763
|
return xhr;
|
|
841
764
|
};
|
|
842
|
-
/* harmony default export */
|
|
765
|
+
/* harmony default export */ const xhr_auth = (ajax);
|
|
843
766
|
|
|
844
|
-
|
|
767
|
+
;// ./src/core/base64.ts
|
|
845
768
|
function encode(s) {
|
|
846
769
|
return btoa(utob(s));
|
|
847
770
|
}
|
|
848
771
|
var fromCharCode = String.fromCharCode;
|
|
849
772
|
var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
850
773
|
var b64tab = {};
|
|
851
|
-
for (var
|
|
852
|
-
b64tab[b64chars.charAt(
|
|
774
|
+
for (var i = 0, l = b64chars.length; i < l; i++) {
|
|
775
|
+
b64tab[b64chars.charAt(i)] = i;
|
|
853
776
|
}
|
|
854
777
|
var cb_utob = function (c) {
|
|
855
778
|
var cc = c.charCodeAt(0);
|
|
@@ -882,7 +805,7 @@ var btoa = window.btoa ||
|
|
|
882
805
|
return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
|
883
806
|
};
|
|
884
807
|
|
|
885
|
-
|
|
808
|
+
;// ./src/core/utils/timers/abstract_timer.ts
|
|
886
809
|
class Timer {
|
|
887
810
|
constructor(set, clear, delay, callback) {
|
|
888
811
|
this.clear = clear;
|
|
@@ -902,9 +825,9 @@ class Timer {
|
|
|
902
825
|
}
|
|
903
826
|
}
|
|
904
827
|
}
|
|
905
|
-
/* harmony default export */
|
|
828
|
+
/* harmony default export */ const abstract_timer = (Timer);
|
|
906
829
|
|
|
907
|
-
|
|
830
|
+
;// ./src/core/utils/timers/index.ts
|
|
908
831
|
|
|
909
832
|
function timers_clearTimeout(timer) {
|
|
910
833
|
window.clearTimeout(timer);
|
|
@@ -912,7 +835,7 @@ function timers_clearTimeout(timer) {
|
|
|
912
835
|
function timers_clearInterval(timer) {
|
|
913
836
|
window.clearInterval(timer);
|
|
914
837
|
}
|
|
915
|
-
class
|
|
838
|
+
class OneOffTimer extends abstract_timer {
|
|
916
839
|
constructor(delay, callback) {
|
|
917
840
|
super(setTimeout, timers_clearTimeout, delay, function (timer) {
|
|
918
841
|
callback();
|
|
@@ -920,7 +843,7 @@ class timers_OneOffTimer extends abstract_timer {
|
|
|
920
843
|
});
|
|
921
844
|
}
|
|
922
845
|
}
|
|
923
|
-
class
|
|
846
|
+
class PeriodicTimer extends abstract_timer {
|
|
924
847
|
constructor(delay, callback) {
|
|
925
848
|
super(setInterval, timers_clearInterval, delay, function (timer) {
|
|
926
849
|
callback();
|
|
@@ -929,7 +852,7 @@ class timers_PeriodicTimer extends abstract_timer {
|
|
|
929
852
|
}
|
|
930
853
|
}
|
|
931
854
|
|
|
932
|
-
|
|
855
|
+
;// ./src/core/util.ts
|
|
933
856
|
|
|
934
857
|
var Util = {
|
|
935
858
|
now() {
|
|
@@ -941,7 +864,7 @@ var Util = {
|
|
|
941
864
|
}
|
|
942
865
|
},
|
|
943
866
|
defer(callback) {
|
|
944
|
-
return new
|
|
867
|
+
return new OneOffTimer(0, callback);
|
|
945
868
|
},
|
|
946
869
|
method(name, ...args) {
|
|
947
870
|
var boundArguments = Array.prototype.slice.call(arguments, 1);
|
|
@@ -950,9 +873,9 @@ var Util = {
|
|
|
950
873
|
};
|
|
951
874
|
},
|
|
952
875
|
};
|
|
953
|
-
/* harmony default export */
|
|
876
|
+
/* harmony default export */ const util = (Util);
|
|
954
877
|
|
|
955
|
-
|
|
878
|
+
;// ./src/core/utils/collections.ts
|
|
956
879
|
|
|
957
880
|
|
|
958
881
|
function extend(target, ...sources) {
|
|
@@ -1146,10 +1069,10 @@ function safeJSONStringify(source) {
|
|
|
1146
1069
|
}
|
|
1147
1070
|
}
|
|
1148
1071
|
|
|
1149
|
-
|
|
1072
|
+
;// ./src/core/logger.ts
|
|
1150
1073
|
|
|
1151
1074
|
|
|
1152
|
-
class
|
|
1075
|
+
class Logger {
|
|
1153
1076
|
constructor() {
|
|
1154
1077
|
this.globalLog = (message) => {
|
|
1155
1078
|
if (window.console && window.console.log) {
|
|
@@ -1184,18 +1107,18 @@ class logger_Logger {
|
|
|
1184
1107
|
}
|
|
1185
1108
|
log(defaultLoggingFunction, ...args) {
|
|
1186
1109
|
var message = stringify.apply(this, arguments);
|
|
1187
|
-
if (
|
|
1188
|
-
|
|
1110
|
+
if (pusher.log) {
|
|
1111
|
+
pusher.log(message);
|
|
1189
1112
|
}
|
|
1190
|
-
else if (
|
|
1113
|
+
else if (pusher.logToConsole) {
|
|
1191
1114
|
const log = defaultLoggingFunction.bind(this);
|
|
1192
1115
|
log(message);
|
|
1193
1116
|
}
|
|
1194
1117
|
}
|
|
1195
1118
|
}
|
|
1196
|
-
/* harmony default export */
|
|
1119
|
+
/* harmony default export */ const logger = (new Logger());
|
|
1197
1120
|
|
|
1198
|
-
|
|
1121
|
+
;// ./src/runtimes/web/auth/jsonp_auth.ts
|
|
1199
1122
|
|
|
1200
1123
|
var jsonp = function (context, query, authOptions, authRequestType, callback) {
|
|
1201
1124
|
if (authOptions.headers !== undefined ||
|
|
@@ -1219,9 +1142,9 @@ var jsonp = function (context, query, authOptions, authRequestType, callback) {
|
|
|
1219
1142
|
var head = document.getElementsByTagName('head')[0] || document.documentElement;
|
|
1220
1143
|
head.insertBefore(script, head.firstChild);
|
|
1221
1144
|
};
|
|
1222
|
-
/* harmony default export */
|
|
1145
|
+
/* harmony default export */ const jsonp_auth = (jsonp);
|
|
1223
1146
|
|
|
1224
|
-
|
|
1147
|
+
;// ./src/runtimes/web/dom/script_request.ts
|
|
1225
1148
|
class ScriptRequest {
|
|
1226
1149
|
constructor(src) {
|
|
1227
1150
|
this.src = src;
|
|
@@ -1283,10 +1206,10 @@ class ScriptRequest {
|
|
|
1283
1206
|
}
|
|
1284
1207
|
}
|
|
1285
1208
|
|
|
1286
|
-
|
|
1209
|
+
;// ./src/runtimes/web/dom/jsonp_request.ts
|
|
1287
1210
|
|
|
1288
1211
|
|
|
1289
|
-
class
|
|
1212
|
+
class JSONPRequest {
|
|
1290
1213
|
constructor(url, data) {
|
|
1291
1214
|
this.url = url;
|
|
1292
1215
|
this.data = data;
|
|
@@ -1307,7 +1230,7 @@ class jsonp_request_JSONPRequest {
|
|
|
1307
1230
|
}
|
|
1308
1231
|
}
|
|
1309
1232
|
|
|
1310
|
-
|
|
1233
|
+
;// ./src/runtimes/web/timeline/jsonp_timeline.ts
|
|
1311
1234
|
|
|
1312
1235
|
|
|
1313
1236
|
var getAgent = function (sender, useTLS) {
|
|
@@ -1332,9 +1255,9 @@ var jsonp_timeline_jsonp = {
|
|
|
1332
1255
|
name: 'jsonp',
|
|
1333
1256
|
getAgent,
|
|
1334
1257
|
};
|
|
1335
|
-
/* harmony default export */
|
|
1258
|
+
/* harmony default export */ const jsonp_timeline = (jsonp_timeline_jsonp);
|
|
1336
1259
|
|
|
1337
|
-
|
|
1260
|
+
;// ./src/core/transports/url_schemes.ts
|
|
1338
1261
|
|
|
1339
1262
|
function getGenericURL(baseScheme, params, path) {
|
|
1340
1263
|
var scheme = baseScheme + (params.useTLS ? 's' : '');
|
|
@@ -1372,9 +1295,9 @@ var sockjs = {
|
|
|
1372
1295
|
},
|
|
1373
1296
|
};
|
|
1374
1297
|
|
|
1375
|
-
|
|
1298
|
+
;// ./src/core/events/callback_registry.ts
|
|
1376
1299
|
|
|
1377
|
-
class
|
|
1300
|
+
class CallbackRegistry {
|
|
1378
1301
|
constructor() {
|
|
1379
1302
|
this._callbacks = {};
|
|
1380
1303
|
}
|
|
@@ -1424,12 +1347,12 @@ function prefix(name) {
|
|
|
1424
1347
|
return '_' + name;
|
|
1425
1348
|
}
|
|
1426
1349
|
|
|
1427
|
-
|
|
1350
|
+
;// ./src/core/events/dispatcher.ts
|
|
1428
1351
|
|
|
1429
1352
|
|
|
1430
|
-
class
|
|
1353
|
+
class Dispatcher {
|
|
1431
1354
|
constructor(failThrough) {
|
|
1432
|
-
this.callbacks = new
|
|
1355
|
+
this.callbacks = new CallbackRegistry();
|
|
1433
1356
|
this.global_callbacks = [];
|
|
1434
1357
|
this.failThrough = failThrough;
|
|
1435
1358
|
}
|
|
@@ -1482,13 +1405,13 @@ class dispatcher_Dispatcher {
|
|
|
1482
1405
|
}
|
|
1483
1406
|
}
|
|
1484
1407
|
|
|
1485
|
-
|
|
1408
|
+
;// ./src/core/transports/transport_connection.ts
|
|
1486
1409
|
|
|
1487
1410
|
|
|
1488
1411
|
|
|
1489
1412
|
|
|
1490
1413
|
|
|
1491
|
-
class
|
|
1414
|
+
class TransportConnection extends Dispatcher {
|
|
1492
1415
|
constructor(hooks, name, priority, key, options) {
|
|
1493
1416
|
super();
|
|
1494
1417
|
this.initialize = runtime.transportConnectionInitializer;
|
|
@@ -1629,9 +1552,9 @@ class transport_connection_TransportConnection extends dispatcher_Dispatcher {
|
|
|
1629
1552
|
}
|
|
1630
1553
|
}
|
|
1631
1554
|
|
|
1632
|
-
|
|
1555
|
+
;// ./src/core/transports/transport.ts
|
|
1633
1556
|
|
|
1634
|
-
class
|
|
1557
|
+
class Transport {
|
|
1635
1558
|
constructor(hooks) {
|
|
1636
1559
|
this.hooks = hooks;
|
|
1637
1560
|
}
|
|
@@ -1639,16 +1562,16 @@ class transport_Transport {
|
|
|
1639
1562
|
return this.hooks.isSupported(environment);
|
|
1640
1563
|
}
|
|
1641
1564
|
createConnection(name, priority, key, options) {
|
|
1642
|
-
return new
|
|
1565
|
+
return new TransportConnection(this.hooks, name, priority, key, options);
|
|
1643
1566
|
}
|
|
1644
1567
|
}
|
|
1645
1568
|
|
|
1646
|
-
|
|
1569
|
+
;// ./src/runtimes/isomorphic/transports/transports.ts
|
|
1647
1570
|
|
|
1648
1571
|
|
|
1649
1572
|
|
|
1650
1573
|
|
|
1651
|
-
var WSTransport = new
|
|
1574
|
+
var WSTransport = new Transport({
|
|
1652
1575
|
urls: ws,
|
|
1653
1576
|
handlesActivityChecks: false,
|
|
1654
1577
|
supportsPing: false,
|
|
@@ -1685,23 +1608,23 @@ var xhrConfiguration = {
|
|
|
1685
1608
|
return runtime.isXHRSupported();
|
|
1686
1609
|
},
|
|
1687
1610
|
};
|
|
1688
|
-
var XHRStreamingTransport = new
|
|
1689
|
-
var XHRPollingTransport = new
|
|
1611
|
+
var XHRStreamingTransport = new Transport((extend({}, streamingConfiguration, xhrConfiguration)));
|
|
1612
|
+
var XHRPollingTransport = new Transport((extend({}, pollingConfiguration, xhrConfiguration)));
|
|
1690
1613
|
var Transports = {
|
|
1691
1614
|
ws: WSTransport,
|
|
1692
1615
|
xhr_streaming: XHRStreamingTransport,
|
|
1693
1616
|
xhr_polling: XHRPollingTransport,
|
|
1694
1617
|
};
|
|
1695
|
-
/* harmony default export */
|
|
1618
|
+
/* harmony default export */ const transports = (Transports);
|
|
1696
1619
|
|
|
1697
|
-
|
|
1620
|
+
;// ./src/runtimes/web/transports/transports.ts
|
|
1698
1621
|
|
|
1699
1622
|
|
|
1700
1623
|
|
|
1701
1624
|
|
|
1702
1625
|
|
|
1703
1626
|
|
|
1704
|
-
var SockJSTransport = new
|
|
1627
|
+
var SockJSTransport = new Transport({
|
|
1705
1628
|
file: 'sockjs',
|
|
1706
1629
|
urls: sockjs,
|
|
1707
1630
|
handlesActivityChecks: true,
|
|
@@ -1732,16 +1655,16 @@ var xdrConfiguration = {
|
|
|
1732
1655
|
return yes;
|
|
1733
1656
|
},
|
|
1734
1657
|
};
|
|
1735
|
-
var XDRStreamingTransport = new
|
|
1736
|
-
var XDRPollingTransport = new
|
|
1658
|
+
var XDRStreamingTransport = new Transport((extend({}, streamingConfiguration, xdrConfiguration)));
|
|
1659
|
+
var XDRPollingTransport = new Transport((extend({}, pollingConfiguration, xdrConfiguration)));
|
|
1737
1660
|
transports.xdr_streaming = XDRStreamingTransport;
|
|
1738
1661
|
transports.xdr_polling = XDRPollingTransport;
|
|
1739
1662
|
transports.sockjs = SockJSTransport;
|
|
1740
|
-
/* harmony default export */
|
|
1663
|
+
/* harmony default export */ const transports_transports = (transports);
|
|
1741
1664
|
|
|
1742
|
-
|
|
1665
|
+
;// ./src/runtimes/web/net_info.ts
|
|
1743
1666
|
|
|
1744
|
-
class
|
|
1667
|
+
class NetInfo extends Dispatcher {
|
|
1745
1668
|
constructor() {
|
|
1746
1669
|
super();
|
|
1747
1670
|
var self = this;
|
|
@@ -1763,12 +1686,12 @@ class net_info_NetInfo extends dispatcher_Dispatcher {
|
|
|
1763
1686
|
}
|
|
1764
1687
|
}
|
|
1765
1688
|
}
|
|
1766
|
-
var
|
|
1689
|
+
var Network = new NetInfo();
|
|
1767
1690
|
|
|
1768
|
-
|
|
1691
|
+
;// ./src/core/transports/assistant_to_the_transport_manager.ts
|
|
1769
1692
|
|
|
1770
1693
|
|
|
1771
|
-
class
|
|
1694
|
+
class AssistantToTheTransportManager {
|
|
1772
1695
|
constructor(manager, transport, options) {
|
|
1773
1696
|
this.manager = manager;
|
|
1774
1697
|
this.transport = transport;
|
|
@@ -1808,7 +1731,7 @@ class assistant_to_the_transport_manager_AssistantToTheTransportManager {
|
|
|
1808
1731
|
}
|
|
1809
1732
|
}
|
|
1810
1733
|
|
|
1811
|
-
|
|
1734
|
+
;// ./src/core/connection/protocol/protocol.ts
|
|
1812
1735
|
const Protocol = {
|
|
1813
1736
|
decodeMessage: function (messageEvent) {
|
|
1814
1737
|
try {
|
|
@@ -1899,14 +1822,14 @@ const Protocol = {
|
|
|
1899
1822
|
}
|
|
1900
1823
|
},
|
|
1901
1824
|
};
|
|
1902
|
-
/* harmony default export */
|
|
1825
|
+
/* harmony default export */ const protocol = (Protocol);
|
|
1903
1826
|
|
|
1904
|
-
|
|
1827
|
+
;// ./src/core/connection/connection.ts
|
|
1905
1828
|
|
|
1906
1829
|
|
|
1907
1830
|
|
|
1908
1831
|
|
|
1909
|
-
class
|
|
1832
|
+
class Connection extends Dispatcher {
|
|
1910
1833
|
constructor(id, transport) {
|
|
1911
1834
|
super();
|
|
1912
1835
|
this.id = id;
|
|
@@ -1926,7 +1849,7 @@ class connection_Connection extends dispatcher_Dispatcher {
|
|
|
1926
1849
|
event.channel = channel;
|
|
1927
1850
|
}
|
|
1928
1851
|
logger.debug('Event sent', event);
|
|
1929
|
-
return this.send(
|
|
1852
|
+
return this.send(protocol.encodeMessage(event));
|
|
1930
1853
|
}
|
|
1931
1854
|
ping() {
|
|
1932
1855
|
if (this.transport.supportsPing()) {
|
|
@@ -1944,7 +1867,7 @@ class connection_Connection extends dispatcher_Dispatcher {
|
|
|
1944
1867
|
message: (messageEvent) => {
|
|
1945
1868
|
var pusherEvent;
|
|
1946
1869
|
try {
|
|
1947
|
-
pusherEvent =
|
|
1870
|
+
pusherEvent = protocol.decodeMessage(messageEvent);
|
|
1948
1871
|
}
|
|
1949
1872
|
catch (e) {
|
|
1950
1873
|
this.emit('error', {
|
|
@@ -1997,8 +1920,8 @@ class connection_Connection extends dispatcher_Dispatcher {
|
|
|
1997
1920
|
});
|
|
1998
1921
|
}
|
|
1999
1922
|
handleCloseEvent(closeEvent) {
|
|
2000
|
-
var action =
|
|
2001
|
-
var error =
|
|
1923
|
+
var action = protocol.getCloseAction(closeEvent);
|
|
1924
|
+
var error = protocol.getCloseError(closeEvent);
|
|
2002
1925
|
if (error) {
|
|
2003
1926
|
this.emit('error', error);
|
|
2004
1927
|
}
|
|
@@ -2008,11 +1931,11 @@ class connection_Connection extends dispatcher_Dispatcher {
|
|
|
2008
1931
|
}
|
|
2009
1932
|
}
|
|
2010
1933
|
|
|
2011
|
-
|
|
1934
|
+
;// ./src/core/connection/handshake/index.ts
|
|
2012
1935
|
|
|
2013
1936
|
|
|
2014
1937
|
|
|
2015
|
-
class
|
|
1938
|
+
class Handshake {
|
|
2016
1939
|
constructor(transport, callback) {
|
|
2017
1940
|
this.transport = transport;
|
|
2018
1941
|
this.callback = callback;
|
|
@@ -2027,7 +1950,7 @@ class handshake_Handshake {
|
|
|
2027
1950
|
this.unbindListeners();
|
|
2028
1951
|
var result;
|
|
2029
1952
|
try {
|
|
2030
|
-
result =
|
|
1953
|
+
result = protocol.processHandshake(m);
|
|
2031
1954
|
}
|
|
2032
1955
|
catch (e) {
|
|
2033
1956
|
this.finish('error', { error: e });
|
|
@@ -2036,7 +1959,7 @@ class handshake_Handshake {
|
|
|
2036
1959
|
}
|
|
2037
1960
|
if (result.action === 'connected') {
|
|
2038
1961
|
this.finish('connected', {
|
|
2039
|
-
connection: new
|
|
1962
|
+
connection: new Connection(result.id, this.transport),
|
|
2040
1963
|
activityTimeout: result.activityTimeout,
|
|
2041
1964
|
});
|
|
2042
1965
|
}
|
|
@@ -2047,8 +1970,8 @@ class handshake_Handshake {
|
|
|
2047
1970
|
};
|
|
2048
1971
|
this.onClosed = (closeEvent) => {
|
|
2049
1972
|
this.unbindListeners();
|
|
2050
|
-
var action =
|
|
2051
|
-
var error =
|
|
1973
|
+
var action = protocol.getCloseAction(closeEvent) || 'backoff';
|
|
1974
|
+
var error = protocol.getCloseError(closeEvent);
|
|
2052
1975
|
this.finish(action, { error: error });
|
|
2053
1976
|
};
|
|
2054
1977
|
this.transport.bind('message', this.onMessage);
|
|
@@ -2063,9 +1986,9 @@ class handshake_Handshake {
|
|
|
2063
1986
|
}
|
|
2064
1987
|
}
|
|
2065
1988
|
|
|
2066
|
-
|
|
1989
|
+
;// ./src/core/timeline/timeline_sender.ts
|
|
2067
1990
|
|
|
2068
|
-
class
|
|
1991
|
+
class TimelineSender {
|
|
2069
1992
|
constructor(timeline, options) {
|
|
2070
1993
|
this.timeline = timeline;
|
|
2071
1994
|
this.options = options || {};
|
|
@@ -2078,13 +2001,13 @@ class timeline_sender_TimelineSender {
|
|
|
2078
2001
|
}
|
|
2079
2002
|
}
|
|
2080
2003
|
|
|
2081
|
-
|
|
2004
|
+
;// ./src/core/channels/channel.ts
|
|
2082
2005
|
|
|
2083
2006
|
|
|
2084
2007
|
|
|
2085
2008
|
|
|
2086
2009
|
|
|
2087
|
-
class
|
|
2010
|
+
class Channel extends Dispatcher {
|
|
2088
2011
|
constructor(name, pusher) {
|
|
2089
2012
|
super(function (event, data) {
|
|
2090
2013
|
logger.debug('No callbacks on ' + name + ' for ' + event);
|
|
@@ -2180,9 +2103,9 @@ class channel_Channel extends dispatcher_Dispatcher {
|
|
|
2180
2103
|
}
|
|
2181
2104
|
}
|
|
2182
2105
|
|
|
2183
|
-
|
|
2106
|
+
;// ./src/core/channels/private_channel.ts
|
|
2184
2107
|
|
|
2185
|
-
class
|
|
2108
|
+
class PrivateChannel extends Channel {
|
|
2186
2109
|
authorize(socketId, callback) {
|
|
2187
2110
|
return this.pusher.config.channelAuthorizer({
|
|
2188
2111
|
channelName: this.name,
|
|
@@ -2191,9 +2114,9 @@ class private_channel_PrivateChannel extends channel_Channel {
|
|
|
2191
2114
|
}
|
|
2192
2115
|
}
|
|
2193
2116
|
|
|
2194
|
-
|
|
2117
|
+
;// ./src/core/channels/members.ts
|
|
2195
2118
|
|
|
2196
|
-
class
|
|
2119
|
+
class Members {
|
|
2197
2120
|
constructor() {
|
|
2198
2121
|
this.reset();
|
|
2199
2122
|
}
|
|
@@ -2244,7 +2167,7 @@ class members_Members {
|
|
|
2244
2167
|
}
|
|
2245
2168
|
}
|
|
2246
2169
|
|
|
2247
|
-
|
|
2170
|
+
;// ./src/core/channels/presence_channel.ts
|
|
2248
2171
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2249
2172
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2250
2173
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2258,10 +2181,10 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
2258
2181
|
|
|
2259
2182
|
|
|
2260
2183
|
|
|
2261
|
-
class
|
|
2184
|
+
class PresenceChannel extends PrivateChannel {
|
|
2262
2185
|
constructor(name, pusher) {
|
|
2263
2186
|
super(name, pusher);
|
|
2264
|
-
this.members = new
|
|
2187
|
+
this.members = new Members();
|
|
2265
2188
|
}
|
|
2266
2189
|
authorize(socketId, callback) {
|
|
2267
2190
|
super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2343,18 +2266,16 @@ class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
|
|
|
2343
2266
|
}
|
|
2344
2267
|
|
|
2345
2268
|
// EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
|
|
2346
|
-
var utf8 = __webpack_require__(
|
|
2347
|
-
|
|
2269
|
+
var utf8 = __webpack_require__(978);
|
|
2348
2270
|
// EXTERNAL MODULE: ./node_modules/@stablelib/base64/lib/base64.js
|
|
2349
|
-
var base64 = __webpack_require__(
|
|
2271
|
+
var base64 = __webpack_require__(594);
|
|
2272
|
+
;// ./src/core/channels/encrypted_channel.ts
|
|
2350
2273
|
|
|
2351
|
-
// CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
|
|
2352
2274
|
|
|
2353
2275
|
|
|
2354
2276
|
|
|
2355
2277
|
|
|
2356
|
-
|
|
2357
|
-
class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
|
|
2278
|
+
class EncryptedChannel extends PrivateChannel {
|
|
2358
2279
|
constructor(name, pusher, nacl) {
|
|
2359
2280
|
super(name, pusher);
|
|
2360
2281
|
this.key = null;
|
|
@@ -2371,7 +2292,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2371
2292
|
callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2372
2293
|
return;
|
|
2373
2294
|
}
|
|
2374
|
-
this.key =
|
|
2295
|
+
this.key = (0,base64.decode)(sharedSecret);
|
|
2375
2296
|
delete authData['shared_secret'];
|
|
2376
2297
|
callback(null, authData);
|
|
2377
2298
|
});
|
|
@@ -2399,12 +2320,12 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2399
2320
|
data);
|
|
2400
2321
|
return;
|
|
2401
2322
|
}
|
|
2402
|
-
let cipherText =
|
|
2323
|
+
let cipherText = (0,base64.decode)(data.ciphertext);
|
|
2403
2324
|
if (cipherText.length < this.nacl.secretbox.overheadLength) {
|
|
2404
2325
|
logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
|
|
2405
2326
|
return;
|
|
2406
2327
|
}
|
|
2407
|
-
let nonce =
|
|
2328
|
+
let nonce = (0,base64.decode)(data.nonce);
|
|
2408
2329
|
if (nonce.length < this.nacl.secretbox.nonceLength) {
|
|
2409
2330
|
logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
|
|
2410
2331
|
return;
|
|
@@ -2430,7 +2351,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2430
2351
|
this.emit(event, this.getDataToEmit(bytes));
|
|
2431
2352
|
}
|
|
2432
2353
|
getDataToEmit(bytes) {
|
|
2433
|
-
let raw =
|
|
2354
|
+
let raw = (0,utf8/* decode */.D4)(bytes);
|
|
2434
2355
|
try {
|
|
2435
2356
|
return JSON.parse(raw);
|
|
2436
2357
|
}
|
|
@@ -2440,13 +2361,13 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
2440
2361
|
}
|
|
2441
2362
|
}
|
|
2442
2363
|
|
|
2443
|
-
|
|
2364
|
+
;// ./src/core/connection/connection_manager.ts
|
|
2444
2365
|
|
|
2445
2366
|
|
|
2446
2367
|
|
|
2447
2368
|
|
|
2448
2369
|
|
|
2449
|
-
class
|
|
2370
|
+
class ConnectionManager extends Dispatcher {
|
|
2450
2371
|
constructor(key, options) {
|
|
2451
2372
|
super();
|
|
2452
2373
|
this.state = 'initialized';
|
|
@@ -2473,6 +2394,11 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2473
2394
|
});
|
|
2474
2395
|
this.updateStrategy();
|
|
2475
2396
|
}
|
|
2397
|
+
switchCluster(key) {
|
|
2398
|
+
this.key = key;
|
|
2399
|
+
this.updateStrategy();
|
|
2400
|
+
this.retryIn(0);
|
|
2401
|
+
}
|
|
2476
2402
|
connect() {
|
|
2477
2403
|
if (this.connection || this.runner) {
|
|
2478
2404
|
return;
|
|
@@ -2556,7 +2482,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2556
2482
|
if (delay > 0) {
|
|
2557
2483
|
this.emit('connecting_in', Math.round(delay / 1000));
|
|
2558
2484
|
}
|
|
2559
|
-
this.retryTimer = new
|
|
2485
|
+
this.retryTimer = new OneOffTimer(delay || 0, () => {
|
|
2560
2486
|
this.disconnectInternally();
|
|
2561
2487
|
this.connect();
|
|
2562
2488
|
});
|
|
@@ -2568,7 +2494,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2568
2494
|
}
|
|
2569
2495
|
}
|
|
2570
2496
|
setUnavailableTimer() {
|
|
2571
|
-
this.unavailableTimer = new
|
|
2497
|
+
this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, () => {
|
|
2572
2498
|
this.updateState('unavailable');
|
|
2573
2499
|
});
|
|
2574
2500
|
}
|
|
@@ -2580,7 +2506,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2580
2506
|
sendActivityCheck() {
|
|
2581
2507
|
this.stopActivityCheck();
|
|
2582
2508
|
this.connection.ping();
|
|
2583
|
-
this.activityTimer = new
|
|
2509
|
+
this.activityTimer = new OneOffTimer(this.options.pongTimeout, () => {
|
|
2584
2510
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout });
|
|
2585
2511
|
this.retryIn(0);
|
|
2586
2512
|
});
|
|
@@ -2588,7 +2514,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2588
2514
|
resetActivityCheck() {
|
|
2589
2515
|
this.stopActivityCheck();
|
|
2590
2516
|
if (this.connection && !this.connection.handlesActivityChecks()) {
|
|
2591
|
-
this.activityTimer = new
|
|
2517
|
+
this.activityTimer = new OneOffTimer(this.activityTimeout, () => {
|
|
2592
2518
|
this.sendActivityCheck();
|
|
2593
2519
|
});
|
|
2594
2520
|
}
|
|
@@ -2696,12 +2622,12 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
2696
2622
|
}
|
|
2697
2623
|
}
|
|
2698
2624
|
|
|
2699
|
-
|
|
2625
|
+
;// ./src/core/channels/channels.ts
|
|
2700
2626
|
|
|
2701
2627
|
|
|
2702
2628
|
|
|
2703
2629
|
|
|
2704
|
-
class
|
|
2630
|
+
class Channels {
|
|
2705
2631
|
constructor() {
|
|
2706
2632
|
this.channels = {};
|
|
2707
2633
|
}
|
|
@@ -2751,7 +2677,7 @@ function createChannel(name, pusher) {
|
|
|
2751
2677
|
}
|
|
2752
2678
|
}
|
|
2753
2679
|
|
|
2754
|
-
|
|
2680
|
+
;// ./src/core/utils/factory.ts
|
|
2755
2681
|
|
|
2756
2682
|
|
|
2757
2683
|
|
|
@@ -2763,38 +2689,38 @@ function createChannel(name, pusher) {
|
|
|
2763
2689
|
|
|
2764
2690
|
var Factory = {
|
|
2765
2691
|
createChannels() {
|
|
2766
|
-
return new
|
|
2692
|
+
return new Channels();
|
|
2767
2693
|
},
|
|
2768
2694
|
createConnectionManager(key, options) {
|
|
2769
|
-
return new
|
|
2695
|
+
return new ConnectionManager(key, options);
|
|
2770
2696
|
},
|
|
2771
2697
|
createChannel(name, pusher) {
|
|
2772
|
-
return new
|
|
2698
|
+
return new Channel(name, pusher);
|
|
2773
2699
|
},
|
|
2774
2700
|
createPrivateChannel(name, pusher) {
|
|
2775
|
-
return new
|
|
2701
|
+
return new PrivateChannel(name, pusher);
|
|
2776
2702
|
},
|
|
2777
2703
|
createPresenceChannel(name, pusher) {
|
|
2778
|
-
return new
|
|
2704
|
+
return new PresenceChannel(name, pusher);
|
|
2779
2705
|
},
|
|
2780
2706
|
createEncryptedChannel(name, pusher, nacl) {
|
|
2781
|
-
return new
|
|
2707
|
+
return new EncryptedChannel(name, pusher, nacl);
|
|
2782
2708
|
},
|
|
2783
2709
|
createTimelineSender(timeline, options) {
|
|
2784
|
-
return new
|
|
2710
|
+
return new TimelineSender(timeline, options);
|
|
2785
2711
|
},
|
|
2786
2712
|
createHandshake(transport, callback) {
|
|
2787
|
-
return new
|
|
2713
|
+
return new Handshake(transport, callback);
|
|
2788
2714
|
},
|
|
2789
2715
|
createAssistantToTheTransportManager(manager, transport, options) {
|
|
2790
|
-
return new
|
|
2716
|
+
return new AssistantToTheTransportManager(manager, transport, options);
|
|
2791
2717
|
},
|
|
2792
2718
|
};
|
|
2793
|
-
/* harmony default export */
|
|
2719
|
+
/* harmony default export */ const factory = (Factory);
|
|
2794
2720
|
|
|
2795
|
-
|
|
2721
|
+
;// ./src/core/transports/transport_manager.ts
|
|
2796
2722
|
|
|
2797
|
-
class
|
|
2723
|
+
class TransportManager {
|
|
2798
2724
|
constructor(options) {
|
|
2799
2725
|
this.options = options || {};
|
|
2800
2726
|
this.livesLeft = this.options.lives || Infinity;
|
|
@@ -2813,11 +2739,11 @@ class transport_manager_TransportManager {
|
|
|
2813
2739
|
}
|
|
2814
2740
|
}
|
|
2815
2741
|
|
|
2816
|
-
|
|
2742
|
+
;// ./src/core/strategies/sequential_strategy.ts
|
|
2817
2743
|
|
|
2818
2744
|
|
|
2819
2745
|
|
|
2820
|
-
class
|
|
2746
|
+
class SequentialStrategy {
|
|
2821
2747
|
constructor(strategies, options) {
|
|
2822
2748
|
this.strategies = strategies;
|
|
2823
2749
|
this.loop = Boolean(options.loop);
|
|
@@ -2873,7 +2799,7 @@ class sequential_strategy_SequentialStrategy {
|
|
|
2873
2799
|
var timer = null;
|
|
2874
2800
|
var runner = null;
|
|
2875
2801
|
if (options.timeout > 0) {
|
|
2876
|
-
timer = new
|
|
2802
|
+
timer = new OneOffTimer(options.timeout, function () {
|
|
2877
2803
|
runner.abort();
|
|
2878
2804
|
callback(true);
|
|
2879
2805
|
});
|
|
@@ -2901,10 +2827,10 @@ class sequential_strategy_SequentialStrategy {
|
|
|
2901
2827
|
}
|
|
2902
2828
|
}
|
|
2903
2829
|
|
|
2904
|
-
|
|
2830
|
+
;// ./src/core/strategies/best_connected_ever_strategy.ts
|
|
2905
2831
|
|
|
2906
2832
|
|
|
2907
|
-
class
|
|
2833
|
+
class BestConnectedEverStrategy {
|
|
2908
2834
|
constructor(strategies) {
|
|
2909
2835
|
this.strategies = strategies;
|
|
2910
2836
|
}
|
|
@@ -2956,12 +2882,12 @@ function abortRunner(runner) {
|
|
|
2956
2882
|
}
|
|
2957
2883
|
}
|
|
2958
2884
|
|
|
2959
|
-
|
|
2885
|
+
;// ./src/core/strategies/websocket_prioritized_cached_strategy.ts
|
|
2960
2886
|
|
|
2961
2887
|
|
|
2962
2888
|
|
|
2963
2889
|
|
|
2964
|
-
class
|
|
2890
|
+
class WebSocketPrioritizedCachedStrategy {
|
|
2965
2891
|
constructor(strategy, transports, options) {
|
|
2966
2892
|
this.strategy = strategy;
|
|
2967
2893
|
this.transports = transports;
|
|
@@ -2986,7 +2912,7 @@ class websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy {
|
|
|
2986
2912
|
transport: info.transport,
|
|
2987
2913
|
latency: info.latency,
|
|
2988
2914
|
});
|
|
2989
|
-
strategies.push(new
|
|
2915
|
+
strategies.push(new SequentialStrategy([transport], {
|
|
2990
2916
|
timeout: info.latency * 2 + 1000,
|
|
2991
2917
|
failFast: true,
|
|
2992
2918
|
}));
|
|
@@ -3072,9 +2998,9 @@ function flushTransportCache(usingTLS) {
|
|
|
3072
2998
|
}
|
|
3073
2999
|
}
|
|
3074
3000
|
|
|
3075
|
-
|
|
3001
|
+
;// ./src/core/strategies/delayed_strategy.ts
|
|
3076
3002
|
|
|
3077
|
-
class
|
|
3003
|
+
class DelayedStrategy {
|
|
3078
3004
|
constructor(strategy, { delay: number }) {
|
|
3079
3005
|
this.strategy = strategy;
|
|
3080
3006
|
this.options = { delay: number };
|
|
@@ -3085,7 +3011,7 @@ class delayed_strategy_DelayedStrategy {
|
|
|
3085
3011
|
connect(minPriority, callback) {
|
|
3086
3012
|
var strategy = this.strategy;
|
|
3087
3013
|
var runner;
|
|
3088
|
-
var timer = new
|
|
3014
|
+
var timer = new OneOffTimer(this.options.delay, function () {
|
|
3089
3015
|
runner = strategy.connect(minPriority, callback);
|
|
3090
3016
|
});
|
|
3091
3017
|
return {
|
|
@@ -3105,7 +3031,7 @@ class delayed_strategy_DelayedStrategy {
|
|
|
3105
3031
|
}
|
|
3106
3032
|
}
|
|
3107
3033
|
|
|
3108
|
-
|
|
3034
|
+
;// ./src/core/strategies/if_strategy.ts
|
|
3109
3035
|
class IfStrategy {
|
|
3110
3036
|
constructor(test, trueBranch, falseBranch) {
|
|
3111
3037
|
this.test = test;
|
|
@@ -3122,7 +3048,7 @@ class IfStrategy {
|
|
|
3122
3048
|
}
|
|
3123
3049
|
}
|
|
3124
3050
|
|
|
3125
|
-
|
|
3051
|
+
;// ./src/core/strategies/first_connected_strategy.ts
|
|
3126
3052
|
class FirstConnectedStrategy {
|
|
3127
3053
|
constructor(strategy) {
|
|
3128
3054
|
this.strategy = strategy;
|
|
@@ -3141,7 +3067,7 @@ class FirstConnectedStrategy {
|
|
|
3141
3067
|
}
|
|
3142
3068
|
}
|
|
3143
3069
|
|
|
3144
|
-
|
|
3070
|
+
;// ./src/runtimes/web/default_strategy.ts
|
|
3145
3071
|
|
|
3146
3072
|
|
|
3147
3073
|
|
|
@@ -3179,11 +3105,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
3179
3105
|
timeout: 15000,
|
|
3180
3106
|
timeoutLimit: 60000,
|
|
3181
3107
|
};
|
|
3182
|
-
var ws_manager = new
|
|
3108
|
+
var ws_manager = new TransportManager({
|
|
3183
3109
|
minPingDelay: 10000,
|
|
3184
3110
|
maxPingDelay: config.activityTimeout,
|
|
3185
3111
|
});
|
|
3186
|
-
var streaming_manager = new
|
|
3112
|
+
var streaming_manager = new TransportManager({
|
|
3187
3113
|
lives: 2,
|
|
3188
3114
|
minPingDelay: 10000,
|
|
3189
3115
|
maxPingDelay: config.activityTimeout,
|
|
@@ -3195,47 +3121,47 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
3195
3121
|
var xdr_streaming_transport = defineTransportStrategy('xdr_streaming', 'xdr_streaming', 1, sockjs_options, streaming_manager);
|
|
3196
3122
|
var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, sockjs_options);
|
|
3197
3123
|
var xdr_polling_transport = defineTransportStrategy('xdr_polling', 'xdr_polling', 1, sockjs_options);
|
|
3198
|
-
var ws_loop = new
|
|
3199
|
-
var wss_loop = new
|
|
3200
|
-
var sockjs_loop = new
|
|
3201
|
-
var streaming_loop = new
|
|
3124
|
+
var ws_loop = new SequentialStrategy([ws_transport], timeouts);
|
|
3125
|
+
var wss_loop = new SequentialStrategy([wss_transport], timeouts);
|
|
3126
|
+
var sockjs_loop = new SequentialStrategy([sockjs_transport], timeouts);
|
|
3127
|
+
var streaming_loop = new SequentialStrategy([
|
|
3202
3128
|
new IfStrategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport),
|
|
3203
3129
|
], timeouts);
|
|
3204
|
-
var polling_loop = new
|
|
3130
|
+
var polling_loop = new SequentialStrategy([
|
|
3205
3131
|
new IfStrategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport),
|
|
3206
3132
|
], timeouts);
|
|
3207
|
-
var http_loop = new
|
|
3208
|
-
new IfStrategy(testSupportsStrategy(streaming_loop), new
|
|
3133
|
+
var http_loop = new SequentialStrategy([
|
|
3134
|
+
new IfStrategy(testSupportsStrategy(streaming_loop), new BestConnectedEverStrategy([
|
|
3209
3135
|
streaming_loop,
|
|
3210
|
-
new
|
|
3136
|
+
new DelayedStrategy(polling_loop, { delay: 4000 }),
|
|
3211
3137
|
]), polling_loop),
|
|
3212
3138
|
], timeouts);
|
|
3213
3139
|
var http_fallback_loop = new IfStrategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
|
|
3214
3140
|
var wsStrategy;
|
|
3215
3141
|
if (baseOptions.useTLS) {
|
|
3216
|
-
wsStrategy = new
|
|
3142
|
+
wsStrategy = new BestConnectedEverStrategy([
|
|
3217
3143
|
ws_loop,
|
|
3218
|
-
new
|
|
3144
|
+
new DelayedStrategy(http_fallback_loop, { delay: 2000 }),
|
|
3219
3145
|
]);
|
|
3220
3146
|
}
|
|
3221
3147
|
else {
|
|
3222
|
-
wsStrategy = new
|
|
3148
|
+
wsStrategy = new BestConnectedEverStrategy([
|
|
3223
3149
|
ws_loop,
|
|
3224
|
-
new
|
|
3225
|
-
new
|
|
3150
|
+
new DelayedStrategy(wss_loop, { delay: 2000 }),
|
|
3151
|
+
new DelayedStrategy(http_fallback_loop, { delay: 5000 }),
|
|
3226
3152
|
]);
|
|
3227
3153
|
}
|
|
3228
|
-
return new
|
|
3154
|
+
return new WebSocketPrioritizedCachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
|
|
3229
3155
|
ttl: 1800000,
|
|
3230
3156
|
timeline: baseOptions.timeline,
|
|
3231
3157
|
useTLS: baseOptions.useTLS,
|
|
3232
3158
|
});
|
|
3233
3159
|
};
|
|
3234
|
-
/* harmony default export */
|
|
3160
|
+
/* harmony default export */ const default_strategy = (getDefaultStrategy);
|
|
3235
3161
|
|
|
3236
|
-
|
|
3162
|
+
;// ./src/runtimes/web/transports/transport_connection_initializer.ts
|
|
3237
3163
|
|
|
3238
|
-
/* harmony default export */
|
|
3164
|
+
/* harmony default export */ function transport_connection_initializer() {
|
|
3239
3165
|
var self = this;
|
|
3240
3166
|
self.timeline.info(self.buildTimelineMessage({
|
|
3241
3167
|
transport: self.name + (self.options.useTLS ? 's' : ''),
|
|
@@ -3262,11 +3188,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
3262
3188
|
else {
|
|
3263
3189
|
self.onClose();
|
|
3264
3190
|
}
|
|
3265
|
-
}
|
|
3191
|
+
}
|
|
3266
3192
|
|
|
3267
|
-
|
|
3193
|
+
;// ./src/runtimes/web/http/http_xdomain_request.ts
|
|
3268
3194
|
|
|
3269
|
-
var
|
|
3195
|
+
var hooks = {
|
|
3270
3196
|
getRequest: function (socket) {
|
|
3271
3197
|
var xdr = new window.XDomainRequest();
|
|
3272
3198
|
xdr.ontimeout = function () {
|
|
@@ -3296,13 +3222,13 @@ var http_xdomain_request_hooks = {
|
|
|
3296
3222
|
xdr.abort();
|
|
3297
3223
|
},
|
|
3298
3224
|
};
|
|
3299
|
-
/* harmony default export */
|
|
3225
|
+
/* harmony default export */ const http_xdomain_request = (hooks);
|
|
3300
3226
|
|
|
3301
|
-
|
|
3227
|
+
;// ./src/core/http/http_request.ts
|
|
3302
3228
|
|
|
3303
3229
|
|
|
3304
3230
|
const MAX_BUFFER_LENGTH = 256 * 1024;
|
|
3305
|
-
class
|
|
3231
|
+
class HTTPRequest extends Dispatcher {
|
|
3306
3232
|
constructor(hooks, method, url) {
|
|
3307
3233
|
super();
|
|
3308
3234
|
this.hooks = hooks;
|
|
@@ -3362,21 +3288,21 @@ class http_request_HTTPRequest extends dispatcher_Dispatcher {
|
|
|
3362
3288
|
}
|
|
3363
3289
|
}
|
|
3364
3290
|
|
|
3365
|
-
|
|
3291
|
+
;// ./src/core/http/state.ts
|
|
3366
3292
|
var State;
|
|
3367
3293
|
(function (State) {
|
|
3368
3294
|
State[State["CONNECTING"] = 0] = "CONNECTING";
|
|
3369
3295
|
State[State["OPEN"] = 1] = "OPEN";
|
|
3370
3296
|
State[State["CLOSED"] = 3] = "CLOSED";
|
|
3371
3297
|
})(State || (State = {}));
|
|
3372
|
-
/* harmony default export */
|
|
3298
|
+
/* harmony default export */ const state = (State);
|
|
3373
3299
|
|
|
3374
|
-
|
|
3300
|
+
;// ./src/core/http/http_socket.ts
|
|
3375
3301
|
|
|
3376
3302
|
|
|
3377
3303
|
|
|
3378
3304
|
var autoIncrement = 1;
|
|
3379
|
-
class
|
|
3305
|
+
class HTTPSocket {
|
|
3380
3306
|
constructor(hooks, url) {
|
|
3381
3307
|
this.hooks = hooks;
|
|
3382
3308
|
this.session = randomNumber(1000) + '/' + randomString(8);
|
|
@@ -3541,9 +3467,9 @@ function randomString(length) {
|
|
|
3541
3467
|
}
|
|
3542
3468
|
return result.join('');
|
|
3543
3469
|
}
|
|
3544
|
-
/* harmony default export */
|
|
3470
|
+
/* harmony default export */ const http_socket = (HTTPSocket);
|
|
3545
3471
|
|
|
3546
|
-
|
|
3472
|
+
;// ./src/core/http/http_streaming_socket.ts
|
|
3547
3473
|
var http_streaming_socket_hooks = {
|
|
3548
3474
|
getReceiveURL: function (url, session) {
|
|
3549
3475
|
return url.base + '/' + session + '/xhr_streaming' + url.queryString;
|
|
@@ -3558,9 +3484,9 @@ var http_streaming_socket_hooks = {
|
|
|
3558
3484
|
socket.onClose(1006, 'Connection interrupted (' + status + ')', false);
|
|
3559
3485
|
},
|
|
3560
3486
|
};
|
|
3561
|
-
/* harmony default export */
|
|
3487
|
+
/* harmony default export */ const http_streaming_socket = (http_streaming_socket_hooks);
|
|
3562
3488
|
|
|
3563
|
-
|
|
3489
|
+
;// ./src/core/http/http_polling_socket.ts
|
|
3564
3490
|
var http_polling_socket_hooks = {
|
|
3565
3491
|
getReceiveURL: function (url, session) {
|
|
3566
3492
|
return url.base + '/' + session + '/xhr' + url.queryString;
|
|
@@ -3579,9 +3505,9 @@ var http_polling_socket_hooks = {
|
|
|
3579
3505
|
}
|
|
3580
3506
|
},
|
|
3581
3507
|
};
|
|
3582
|
-
/* harmony default export */
|
|
3508
|
+
/* harmony default export */ const http_polling_socket = (http_polling_socket_hooks);
|
|
3583
3509
|
|
|
3584
|
-
|
|
3510
|
+
;// ./src/runtimes/isomorphic/http/http_xhr_request.ts
|
|
3585
3511
|
|
|
3586
3512
|
var http_xhr_request_hooks = {
|
|
3587
3513
|
getRequest: function (socket) {
|
|
@@ -3610,9 +3536,9 @@ var http_xhr_request_hooks = {
|
|
|
3610
3536
|
xhr.abort();
|
|
3611
3537
|
},
|
|
3612
3538
|
};
|
|
3613
|
-
/* harmony default export */
|
|
3539
|
+
/* harmony default export */ const http_xhr_request = (http_xhr_request_hooks);
|
|
3614
3540
|
|
|
3615
|
-
|
|
3541
|
+
;// ./src/runtimes/isomorphic/http/http.ts
|
|
3616
3542
|
|
|
3617
3543
|
|
|
3618
3544
|
|
|
@@ -3632,20 +3558,20 @@ var HTTP = {
|
|
|
3632
3558
|
return this.createRequest(http_xhr_request, method, url);
|
|
3633
3559
|
},
|
|
3634
3560
|
createRequest(hooks, method, url) {
|
|
3635
|
-
return new
|
|
3561
|
+
return new HTTPRequest(hooks, method, url);
|
|
3636
3562
|
},
|
|
3637
3563
|
};
|
|
3638
|
-
/* harmony default export */
|
|
3564
|
+
/* harmony default export */ const http_http = (HTTP);
|
|
3639
3565
|
|
|
3640
|
-
|
|
3566
|
+
;// ./src/runtimes/web/http/http.ts
|
|
3641
3567
|
|
|
3642
3568
|
|
|
3643
3569
|
http_http.createXDR = function (method, url) {
|
|
3644
3570
|
return this.createRequest(http_xdomain_request, method, url);
|
|
3645
3571
|
};
|
|
3646
|
-
/* harmony default export */
|
|
3572
|
+
/* harmony default export */ const web_http_http = (http_http);
|
|
3647
3573
|
|
|
3648
|
-
|
|
3574
|
+
;// ./src/runtimes/web/runtime.ts
|
|
3649
3575
|
|
|
3650
3576
|
|
|
3651
3577
|
|
|
@@ -3706,7 +3632,7 @@ var Runtime = {
|
|
|
3706
3632
|
}
|
|
3707
3633
|
},
|
|
3708
3634
|
createJSONPRequest(url, data) {
|
|
3709
|
-
return new
|
|
3635
|
+
return new JSONPRequest(url, data);
|
|
3710
3636
|
},
|
|
3711
3637
|
createScriptRequest(src) {
|
|
3712
3638
|
return new ScriptRequest(src);
|
|
@@ -3735,7 +3661,7 @@ var Runtime = {
|
|
|
3735
3661
|
return new ActiveXObject('Microsoft.XMLHTTP');
|
|
3736
3662
|
},
|
|
3737
3663
|
getNetwork() {
|
|
3738
|
-
return
|
|
3664
|
+
return Network;
|
|
3739
3665
|
},
|
|
3740
3666
|
createWebSocket(url) {
|
|
3741
3667
|
var Constructor = this.getWebSocketAPI();
|
|
@@ -3786,22 +3712,22 @@ var Runtime = {
|
|
|
3786
3712
|
return Math.floor(random() * max);
|
|
3787
3713
|
},
|
|
3788
3714
|
};
|
|
3789
|
-
/* harmony default export */
|
|
3715
|
+
/* harmony default export */ const runtime = (Runtime);
|
|
3790
3716
|
|
|
3791
|
-
|
|
3717
|
+
;// ./src/core/timeline/level.ts
|
|
3792
3718
|
var TimelineLevel;
|
|
3793
3719
|
(function (TimelineLevel) {
|
|
3794
3720
|
TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
|
|
3795
3721
|
TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
|
|
3796
3722
|
TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
|
|
3797
3723
|
})(TimelineLevel || (TimelineLevel = {}));
|
|
3798
|
-
/* harmony default export */
|
|
3724
|
+
/* harmony default export */ const level = (TimelineLevel);
|
|
3799
3725
|
|
|
3800
|
-
|
|
3726
|
+
;// ./src/core/timeline/timeline.ts
|
|
3801
3727
|
|
|
3802
3728
|
|
|
3803
3729
|
|
|
3804
|
-
class
|
|
3730
|
+
class Timeline {
|
|
3805
3731
|
constructor(key, session, options) {
|
|
3806
3732
|
this.key = key;
|
|
3807
3733
|
this.session = session;
|
|
@@ -3819,13 +3745,13 @@ class timeline_Timeline {
|
|
|
3819
3745
|
}
|
|
3820
3746
|
}
|
|
3821
3747
|
error(event) {
|
|
3822
|
-
this.log(
|
|
3748
|
+
this.log(level.ERROR, event);
|
|
3823
3749
|
}
|
|
3824
3750
|
info(event) {
|
|
3825
|
-
this.log(
|
|
3751
|
+
this.log(level.INFO, event);
|
|
3826
3752
|
}
|
|
3827
3753
|
debug(event) {
|
|
3828
|
-
this.log(
|
|
3754
|
+
this.log(level.DEBUG, event);
|
|
3829
3755
|
}
|
|
3830
3756
|
isEmpty() {
|
|
3831
3757
|
return this.events.length === 0;
|
|
@@ -3858,12 +3784,12 @@ class timeline_Timeline {
|
|
|
3858
3784
|
}
|
|
3859
3785
|
}
|
|
3860
3786
|
|
|
3861
|
-
|
|
3787
|
+
;// ./src/core/strategies/transport_strategy.ts
|
|
3862
3788
|
|
|
3863
3789
|
|
|
3864
3790
|
|
|
3865
3791
|
|
|
3866
|
-
class
|
|
3792
|
+
class TransportStrategy {
|
|
3867
3793
|
constructor(name, priority, transport, options) {
|
|
3868
3794
|
this.name = name;
|
|
3869
3795
|
this.priority = priority;
|
|
@@ -3956,14 +3882,14 @@ function failAttempt(error, callback) {
|
|
|
3956
3882
|
};
|
|
3957
3883
|
}
|
|
3958
3884
|
|
|
3959
|
-
|
|
3885
|
+
;// ./src/core/strategies/strategy_builder.ts
|
|
3960
3886
|
|
|
3961
3887
|
|
|
3962
3888
|
|
|
3963
3889
|
|
|
3964
3890
|
|
|
3965
3891
|
const { Transports: strategy_builder_Transports } = runtime;
|
|
3966
|
-
var
|
|
3892
|
+
var defineTransport = function (config, name, type, priority, options, manager) {
|
|
3967
3893
|
var transportClass = strategy_builder_Transports[type];
|
|
3968
3894
|
if (!transportClass) {
|
|
3969
3895
|
throw new UnsupportedTransport(type);
|
|
@@ -3975,7 +3901,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
|
|
|
3975
3901
|
var transport;
|
|
3976
3902
|
if (enabled) {
|
|
3977
3903
|
options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
|
|
3978
|
-
transport = new
|
|
3904
|
+
transport = new TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
|
|
3979
3905
|
}
|
|
3980
3906
|
else {
|
|
3981
3907
|
transport = strategy_builder_UnsupportedStrategy;
|
|
@@ -3999,7 +3925,7 @@ var strategy_builder_UnsupportedStrategy = {
|
|
|
3999
3925
|
},
|
|
4000
3926
|
};
|
|
4001
3927
|
|
|
4002
|
-
|
|
3928
|
+
;// ./src/core/options.ts
|
|
4003
3929
|
|
|
4004
3930
|
function validateOptions(options) {
|
|
4005
3931
|
if (options == null) {
|
|
@@ -4013,7 +3939,7 @@ function validateOptions(options) {
|
|
|
4013
3939
|
}
|
|
4014
3940
|
}
|
|
4015
3941
|
|
|
4016
|
-
|
|
3942
|
+
;// ./src/core/auth/user_authenticator.ts
|
|
4017
3943
|
|
|
4018
3944
|
|
|
4019
3945
|
const composeChannelQuery = (params, authOptions) => {
|
|
@@ -4046,9 +3972,9 @@ const UserAuthenticator = (authOptions) => {
|
|
|
4046
3972
|
runtime.getAuthorizers()[authOptions.transport](runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
|
|
4047
3973
|
};
|
|
4048
3974
|
};
|
|
4049
|
-
/* harmony default export */
|
|
3975
|
+
/* harmony default export */ const user_authenticator = (UserAuthenticator);
|
|
4050
3976
|
|
|
4051
|
-
|
|
3977
|
+
;// ./src/core/auth/channel_authorizer.ts
|
|
4052
3978
|
|
|
4053
3979
|
|
|
4054
3980
|
const channel_authorizer_composeChannelQuery = (params, authOptions) => {
|
|
@@ -4082,9 +4008,9 @@ const ChannelAuthorizer = (authOptions) => {
|
|
|
4082
4008
|
runtime.getAuthorizers()[authOptions.transport](runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
|
|
4083
4009
|
};
|
|
4084
4010
|
};
|
|
4085
|
-
/* harmony default export */
|
|
4011
|
+
/* harmony default export */ const channel_authorizer = (ChannelAuthorizer);
|
|
4086
4012
|
|
|
4087
|
-
|
|
4013
|
+
;// ./src/core/auth/deprecated_channel_authorizer.ts
|
|
4088
4014
|
const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
|
|
4089
4015
|
const deprecatedAuthorizerOptions = {
|
|
4090
4016
|
authTransport: authOptions.transport,
|
|
@@ -4101,7 +4027,7 @@ const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator)
|
|
|
4101
4027
|
};
|
|
4102
4028
|
};
|
|
4103
4029
|
|
|
4104
|
-
|
|
4030
|
+
;// ./src/core/config.ts
|
|
4105
4031
|
|
|
4106
4032
|
|
|
4107
4033
|
|
|
@@ -4176,10 +4102,12 @@ function getEnableStatsConfig(opts) {
|
|
|
4176
4102
|
}
|
|
4177
4103
|
return false;
|
|
4178
4104
|
}
|
|
4105
|
+
const hasCustomHandler = (auth) => {
|
|
4106
|
+
return 'customHandler' in auth && auth['customHandler'] != null;
|
|
4107
|
+
};
|
|
4179
4108
|
function buildUserAuthenticator(opts) {
|
|
4180
4109
|
const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
4181
|
-
if (
|
|
4182
|
-
userAuthentication['customHandler'] != null) {
|
|
4110
|
+
if (hasCustomHandler(userAuthentication)) {
|
|
4183
4111
|
return userAuthentication['customHandler'];
|
|
4184
4112
|
}
|
|
4185
4113
|
return user_authenticator(userAuthentication);
|
|
@@ -4200,24 +4128,26 @@ function buildChannelAuth(opts, pusher) {
|
|
|
4200
4128
|
if ('headers' in opts.auth)
|
|
4201
4129
|
channelAuthorization.headers = opts.auth.headers;
|
|
4202
4130
|
}
|
|
4203
|
-
if ('authorizer' in opts)
|
|
4204
|
-
|
|
4131
|
+
if ('authorizer' in opts) {
|
|
4132
|
+
return {
|
|
4133
|
+
customHandler: ChannelAuthorizerProxy(pusher, channelAuthorization, opts.authorizer),
|
|
4134
|
+
};
|
|
4135
|
+
}
|
|
4205
4136
|
}
|
|
4206
4137
|
return channelAuthorization;
|
|
4207
4138
|
}
|
|
4208
4139
|
function buildChannelAuthorizer(opts, pusher) {
|
|
4209
4140
|
const channelAuthorization = buildChannelAuth(opts, pusher);
|
|
4210
|
-
if (
|
|
4211
|
-
channelAuthorization['customHandler'] != null) {
|
|
4141
|
+
if (hasCustomHandler(channelAuthorization)) {
|
|
4212
4142
|
return channelAuthorization['customHandler'];
|
|
4213
4143
|
}
|
|
4214
4144
|
return channel_authorizer(channelAuthorization);
|
|
4215
4145
|
}
|
|
4216
4146
|
|
|
4217
|
-
|
|
4147
|
+
;// ./src/core/watchlist.ts
|
|
4218
4148
|
|
|
4219
4149
|
|
|
4220
|
-
class
|
|
4150
|
+
class WatchlistFacade extends Dispatcher {
|
|
4221
4151
|
constructor(pusher) {
|
|
4222
4152
|
super(function (eventName, data) {
|
|
4223
4153
|
logger.debug(`No callbacks on watchlist events for ${eventName}`);
|
|
@@ -4240,7 +4170,7 @@ class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
|
|
|
4240
4170
|
}
|
|
4241
4171
|
}
|
|
4242
4172
|
|
|
4243
|
-
|
|
4173
|
+
;// ./src/core/utils/flat_promise.ts
|
|
4244
4174
|
function flatPromise() {
|
|
4245
4175
|
let resolve, reject;
|
|
4246
4176
|
const promise = new Promise((res, rej) => {
|
|
@@ -4249,15 +4179,15 @@ function flatPromise() {
|
|
|
4249
4179
|
});
|
|
4250
4180
|
return { promise, resolve, reject };
|
|
4251
4181
|
}
|
|
4252
|
-
/* harmony default export */
|
|
4182
|
+
/* harmony default export */ const flat_promise = (flatPromise);
|
|
4253
4183
|
|
|
4254
|
-
|
|
4184
|
+
;// ./src/core/user.ts
|
|
4255
4185
|
|
|
4256
4186
|
|
|
4257
4187
|
|
|
4258
4188
|
|
|
4259
4189
|
|
|
4260
|
-
class
|
|
4190
|
+
class UserFacade extends Dispatcher {
|
|
4261
4191
|
constructor(pusher) {
|
|
4262
4192
|
super(function (eventName, data) {
|
|
4263
4193
|
logger.debug('No callbacks on user for ' + eventName);
|
|
@@ -4288,7 +4218,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
4288
4218
|
this._newSigninPromiseIfNeeded();
|
|
4289
4219
|
}
|
|
4290
4220
|
});
|
|
4291
|
-
this.watchlist = new
|
|
4221
|
+
this.watchlist = new WatchlistFacade(pusher);
|
|
4292
4222
|
this.pusher.connection.bind('message', (event) => {
|
|
4293
4223
|
var eventName = event.event;
|
|
4294
4224
|
if (eventName === 'pusher:signin_success') {
|
|
@@ -4346,7 +4276,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
4346
4276
|
channel.subscribe();
|
|
4347
4277
|
}
|
|
4348
4278
|
};
|
|
4349
|
-
this.serverToUserChannel = new
|
|
4279
|
+
this.serverToUserChannel = new Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
|
|
4350
4280
|
this.serverToUserChannel.bind_global((eventName, data) => {
|
|
4351
4281
|
if (eventName.indexOf('pusher_internal:') === 0 ||
|
|
4352
4282
|
eventName.indexOf('pusher:') === 0) {
|
|
@@ -4385,7 +4315,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
4385
4315
|
}
|
|
4386
4316
|
}
|
|
4387
4317
|
|
|
4388
|
-
|
|
4318
|
+
;// ./src/core/pusher.ts
|
|
4389
4319
|
|
|
4390
4320
|
|
|
4391
4321
|
|
|
@@ -4399,11 +4329,11 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
4399
4329
|
|
|
4400
4330
|
|
|
4401
4331
|
|
|
4402
|
-
class
|
|
4332
|
+
class Pusher {
|
|
4403
4333
|
static ready() {
|
|
4404
|
-
|
|
4405
|
-
for (var i = 0, l =
|
|
4406
|
-
|
|
4334
|
+
Pusher.isReady = true;
|
|
4335
|
+
for (var i = 0, l = Pusher.instances.length; i < l; i++) {
|
|
4336
|
+
Pusher.instances[i].connect();
|
|
4407
4337
|
}
|
|
4408
4338
|
}
|
|
4409
4339
|
static getClientFeatures() {
|
|
@@ -4415,16 +4345,17 @@ class pusher_Pusher {
|
|
|
4415
4345
|
checkAppKey(app_key);
|
|
4416
4346
|
validateOptions(options);
|
|
4417
4347
|
this.key = app_key;
|
|
4418
|
-
this.
|
|
4348
|
+
this.options = options;
|
|
4349
|
+
this.config = getConfig(this.options, this);
|
|
4419
4350
|
this.channels = factory.createChannels();
|
|
4420
|
-
this.global_emitter = new
|
|
4351
|
+
this.global_emitter = new Dispatcher();
|
|
4421
4352
|
this.sessionID = runtime.randomInt(1000000000);
|
|
4422
|
-
this.timeline = new
|
|
4353
|
+
this.timeline = new Timeline(this.key, this.sessionID, {
|
|
4423
4354
|
cluster: this.config.cluster,
|
|
4424
|
-
features:
|
|
4355
|
+
features: Pusher.getClientFeatures(),
|
|
4425
4356
|
params: this.config.timelineParams || {},
|
|
4426
4357
|
limit: 50,
|
|
4427
|
-
level:
|
|
4358
|
+
level: level.INFO,
|
|
4428
4359
|
version: defaults.VERSION,
|
|
4429
4360
|
});
|
|
4430
4361
|
if (this.config.enableStats) {
|
|
@@ -4434,7 +4365,7 @@ class pusher_Pusher {
|
|
|
4434
4365
|
});
|
|
4435
4366
|
}
|
|
4436
4367
|
var getStrategy = (options) => {
|
|
4437
|
-
return runtime.getDefaultStrategy(this.config, options,
|
|
4368
|
+
return runtime.getDefaultStrategy(this.config, options, defineTransport);
|
|
4438
4369
|
};
|
|
4439
4370
|
this.connection = factory.createConnectionManager(this.key, {
|
|
4440
4371
|
getStrategy: getStrategy,
|
|
@@ -4472,13 +4403,20 @@ class pusher_Pusher {
|
|
|
4472
4403
|
this.connection.bind('error', (err) => {
|
|
4473
4404
|
logger.warn(err);
|
|
4474
4405
|
});
|
|
4475
|
-
|
|
4476
|
-
this.timeline.info({ instances:
|
|
4477
|
-
this.user = new
|
|
4478
|
-
if (
|
|
4406
|
+
Pusher.instances.push(this);
|
|
4407
|
+
this.timeline.info({ instances: Pusher.instances.length });
|
|
4408
|
+
this.user = new UserFacade(this);
|
|
4409
|
+
if (Pusher.isReady) {
|
|
4479
4410
|
this.connect();
|
|
4480
4411
|
}
|
|
4481
4412
|
}
|
|
4413
|
+
switchCluster(options) {
|
|
4414
|
+
const { appKey, cluster } = options;
|
|
4415
|
+
this.key = appKey;
|
|
4416
|
+
this.options = Object.assign(Object.assign({}, this.options), { cluster });
|
|
4417
|
+
this.config = getConfig(this.options, this);
|
|
4418
|
+
this.connection.switchCluster(this.key);
|
|
4419
|
+
}
|
|
4482
4420
|
channel(name) {
|
|
4483
4421
|
return this.channels.find(name);
|
|
4484
4422
|
}
|
|
@@ -4491,7 +4429,7 @@ class pusher_Pusher {
|
|
|
4491
4429
|
if (!this.timelineSenderTimer) {
|
|
4492
4430
|
var usingTLS = this.connection.isUsingTLS();
|
|
4493
4431
|
var timelineSender = this.timelineSender;
|
|
4494
|
-
this.timelineSenderTimer = new
|
|
4432
|
+
this.timelineSenderTimer = new PeriodicTimer(60000, function () {
|
|
4495
4433
|
timelineSender.send(usingTLS);
|
|
4496
4434
|
});
|
|
4497
4435
|
}
|
|
@@ -4565,23 +4503,77 @@ class pusher_Pusher {
|
|
|
4565
4503
|
this.user.signin();
|
|
4566
4504
|
}
|
|
4567
4505
|
}
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
/* harmony default export */
|
|
4506
|
+
Pusher.instances = [];
|
|
4507
|
+
Pusher.isReady = false;
|
|
4508
|
+
Pusher.logToConsole = false;
|
|
4509
|
+
Pusher.Runtime = runtime;
|
|
4510
|
+
Pusher.ScriptReceivers = runtime.ScriptReceivers;
|
|
4511
|
+
Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
|
|
4512
|
+
Pusher.auth_callbacks = runtime.auth_callbacks;
|
|
4513
|
+
/* harmony default export */ const pusher = (Pusher);
|
|
4576
4514
|
function checkAppKey(key) {
|
|
4577
4515
|
if (key === null || key === undefined) {
|
|
4578
4516
|
throw 'You must pass your app key when you instantiate Pusher.';
|
|
4579
4517
|
}
|
|
4580
4518
|
}
|
|
4581
|
-
runtime.setup(
|
|
4519
|
+
runtime.setup(Pusher);
|
|
4582
4520
|
|
|
4583
4521
|
|
|
4584
|
-
/***/ }
|
|
4585
|
-
|
|
4522
|
+
/***/ }
|
|
4523
|
+
|
|
4524
|
+
/******/ });
|
|
4525
|
+
/************************************************************************/
|
|
4526
|
+
/******/ // The module cache
|
|
4527
|
+
/******/ var __webpack_module_cache__ = {};
|
|
4528
|
+
/******/
|
|
4529
|
+
/******/ // The require function
|
|
4530
|
+
/******/ function __webpack_require__(moduleId) {
|
|
4531
|
+
/******/ // Check if module is in cache
|
|
4532
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
4533
|
+
/******/ if (cachedModule !== undefined) {
|
|
4534
|
+
/******/ return cachedModule.exports;
|
|
4535
|
+
/******/ }
|
|
4536
|
+
/******/ // Create a new module (and put it into the cache)
|
|
4537
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
4538
|
+
/******/ // no module.id needed
|
|
4539
|
+
/******/ // no module.loaded needed
|
|
4540
|
+
/******/ exports: {}
|
|
4541
|
+
/******/ };
|
|
4542
|
+
/******/
|
|
4543
|
+
/******/ // Execute the module function
|
|
4544
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
4545
|
+
/******/
|
|
4546
|
+
/******/ // Return the exports of the module
|
|
4547
|
+
/******/ return module.exports;
|
|
4548
|
+
/******/ }
|
|
4549
|
+
/******/
|
|
4550
|
+
/************************************************************************/
|
|
4551
|
+
/******/ /* webpack/runtime/define property getters */
|
|
4552
|
+
/******/ (() => {
|
|
4553
|
+
/******/ // define getter functions for harmony exports
|
|
4554
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
4555
|
+
/******/ for(var key in definition) {
|
|
4556
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
4557
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
4558
|
+
/******/ }
|
|
4559
|
+
/******/ }
|
|
4560
|
+
/******/ };
|
|
4561
|
+
/******/ })();
|
|
4562
|
+
/******/
|
|
4563
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
4564
|
+
/******/ (() => {
|
|
4565
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
4566
|
+
/******/ })();
|
|
4567
|
+
/******/
|
|
4568
|
+
/************************************************************************/
|
|
4569
|
+
/******/
|
|
4570
|
+
/******/ // startup
|
|
4571
|
+
/******/ // Load entry module and return exports
|
|
4572
|
+
/******/ // This entry module used 'module' so it can't be inlined
|
|
4573
|
+
/******/ var __webpack_exports__ = __webpack_require__(721);
|
|
4574
|
+
/******/
|
|
4575
|
+
/******/ return __webpack_exports__;
|
|
4576
|
+
/******/ })()
|
|
4577
|
+
;
|
|
4586
4578
|
});
|
|
4587
4579
|
//# sourceMappingURL=pusher.js.map
|