pusher-js 8.0.2 → 8.2.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/CHANGELOG.md +9 -0
- package/dist/node/pusher.js +968 -1391
- package/dist/node/pusher.js.map +1 -1
- package/dist/react-native/pusher.js +2 -2
- package/dist/react-native/pusher.js.map +1 -1
- package/dist/web/pusher-with-encryption.js +1003 -1434
- package/dist/web/pusher-with-encryption.js.map +1 -1
- package/dist/web/pusher-with-encryption.min.js +2 -2
- package/dist/web/pusher-with-encryption.min.js.map +1 -1
- package/dist/web/pusher.js +994 -1410
- package/dist/web/pusher.js.map +1 -1
- package/dist/web/pusher.min.js +2 -2
- package/dist/web/pusher.min.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.js +968 -1390
- package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.min.js +2 -2
- package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
- package/dist/worker/pusher.worker.js +959 -1366
- package/dist/worker/pusher.worker.js.map +1 -1
- package/dist/worker/pusher.worker.min.js +2 -2
- package/dist/worker/pusher.worker.min.js.map +1 -1
- package/package.json +6 -6
- package/src/runtimes/isomorphic/default_strategy.ts +0 -1
- package/src/runtimes/web/default_strategy.ts +0 -1
- package/tsconfig.json +1 -1
- package/types/src/core/auth/options.d.ts +3 -3
- package/types/src/core/config.d.ts +2 -2
- package/types/src/core/strategies/transport_strategy.d.ts +0 -3
- package/types/src/core/utils/timers/scheduling.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Pusher JavaScript Library v8.0
|
|
2
|
+
* Pusher JavaScript Library v8.2.0
|
|
3
3
|
* https://pusher.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2020, Pusher
|
|
@@ -603,43 +603,28 @@ var btoa = self.btoa ||
|
|
|
603
603
|
};
|
|
604
604
|
|
|
605
605
|
// CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
var _this = this;
|
|
606
|
+
class Timer {
|
|
607
|
+
constructor(set, clear, delay, callback) {
|
|
609
608
|
this.clear = clear;
|
|
610
|
-
this.timer = set(
|
|
611
|
-
if (
|
|
612
|
-
|
|
609
|
+
this.timer = set(() => {
|
|
610
|
+
if (this.timer) {
|
|
611
|
+
this.timer = callback(this.timer);
|
|
613
612
|
}
|
|
614
613
|
}, delay);
|
|
615
614
|
}
|
|
616
|
-
|
|
615
|
+
isRunning() {
|
|
617
616
|
return this.timer !== null;
|
|
618
|
-
}
|
|
619
|
-
|
|
617
|
+
}
|
|
618
|
+
ensureAborted() {
|
|
620
619
|
if (this.timer) {
|
|
621
620
|
this.clear(this.timer);
|
|
622
621
|
this.timer = null;
|
|
623
622
|
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
}());
|
|
623
|
+
}
|
|
624
|
+
}
|
|
627
625
|
/* harmony default export */ var abstract_timer = (Timer);
|
|
628
626
|
|
|
629
627
|
// CONCATENATED MODULE: ./src/core/utils/timers/index.ts
|
|
630
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
631
|
-
var extendStatics = function (d, b) {
|
|
632
|
-
extendStatics = Object.setPrototypeOf ||
|
|
633
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
634
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
635
|
-
return extendStatics(d, b);
|
|
636
|
-
};
|
|
637
|
-
return function (d, b) {
|
|
638
|
-
extendStatics(d, b);
|
|
639
|
-
function __() { this.constructor = d; }
|
|
640
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
641
|
-
};
|
|
642
|
-
})();
|
|
643
628
|
|
|
644
629
|
function timers_clearTimeout(timer) {
|
|
645
630
|
self.clearTimeout(timer);
|
|
@@ -647,33 +632,27 @@ function timers_clearTimeout(timer) {
|
|
|
647
632
|
function timers_clearInterval(timer) {
|
|
648
633
|
self.clearInterval(timer);
|
|
649
634
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
|
|
635
|
+
class timers_OneOffTimer extends abstract_timer {
|
|
636
|
+
constructor(delay, callback) {
|
|
637
|
+
super(setTimeout, timers_clearTimeout, delay, function (timer) {
|
|
654
638
|
callback();
|
|
655
639
|
return null;
|
|
656
|
-
})
|
|
640
|
+
});
|
|
657
641
|
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
__extends(PeriodicTimer, _super);
|
|
663
|
-
function PeriodicTimer(delay, callback) {
|
|
664
|
-
return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
|
|
642
|
+
}
|
|
643
|
+
class timers_PeriodicTimer extends abstract_timer {
|
|
644
|
+
constructor(delay, callback) {
|
|
645
|
+
super(setInterval, timers_clearInterval, delay, function (timer) {
|
|
665
646
|
callback();
|
|
666
647
|
return timer;
|
|
667
|
-
})
|
|
648
|
+
});
|
|
668
649
|
}
|
|
669
|
-
|
|
670
|
-
}(abstract_timer));
|
|
671
|
-
|
|
650
|
+
}
|
|
672
651
|
|
|
673
652
|
// CONCATENATED MODULE: ./src/core/util.ts
|
|
674
653
|
|
|
675
654
|
var Util = {
|
|
676
|
-
now
|
|
655
|
+
now() {
|
|
677
656
|
if (Date.now) {
|
|
678
657
|
return Date.now();
|
|
679
658
|
}
|
|
@@ -681,14 +660,10 @@ var Util = {
|
|
|
681
660
|
return new Date().valueOf();
|
|
682
661
|
}
|
|
683
662
|
},
|
|
684
|
-
defer
|
|
685
|
-
return new
|
|
663
|
+
defer(callback) {
|
|
664
|
+
return new timers_OneOffTimer(0, callback);
|
|
686
665
|
},
|
|
687
|
-
method
|
|
688
|
-
var args = [];
|
|
689
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
690
|
-
args[_i - 1] = arguments[_i];
|
|
691
|
-
}
|
|
666
|
+
method(name, ...args) {
|
|
692
667
|
var boundArguments = Array.prototype.slice.call(arguments, 1);
|
|
693
668
|
return function (object) {
|
|
694
669
|
return object[name].apply(object, boundArguments.concat(arguments));
|
|
@@ -700,11 +675,7 @@ var Util = {
|
|
|
700
675
|
// CONCATENATED MODULE: ./src/core/utils/collections.ts
|
|
701
676
|
|
|
702
677
|
|
|
703
|
-
function extend(target) {
|
|
704
|
-
var sources = [];
|
|
705
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
706
|
-
sources[_i - 1] = arguments[_i];
|
|
707
|
-
}
|
|
678
|
+
function extend(target, ...sources) {
|
|
708
679
|
for (var i = 0; i < sources.length; i++) {
|
|
709
680
|
var extensions = sources[i];
|
|
710
681
|
for (var property in extensions) {
|
|
@@ -897,7 +868,7 @@ function safeJSONStringify(source) {
|
|
|
897
868
|
|
|
898
869
|
// CONCATENATED MODULE: ./src/core/defaults.ts
|
|
899
870
|
var Defaults = {
|
|
900
|
-
VERSION: "8.0
|
|
871
|
+
VERSION: "8.2.0",
|
|
901
872
|
PROTOCOL: 7,
|
|
902
873
|
wsPort: 80,
|
|
903
874
|
wssPort: 443,
|
|
@@ -966,14 +937,14 @@ var sockjs = {
|
|
|
966
937
|
|
|
967
938
|
// CONCATENATED MODULE: ./src/core/events/callback_registry.ts
|
|
968
939
|
|
|
969
|
-
|
|
970
|
-
|
|
940
|
+
class callback_registry_CallbackRegistry {
|
|
941
|
+
constructor() {
|
|
971
942
|
this._callbacks = {};
|
|
972
943
|
}
|
|
973
|
-
|
|
944
|
+
get(name) {
|
|
974
945
|
return this._callbacks[prefix(name)];
|
|
975
|
-
}
|
|
976
|
-
|
|
946
|
+
}
|
|
947
|
+
add(name, callback, context) {
|
|
977
948
|
var prefixedEventName = prefix(name);
|
|
978
949
|
this._callbacks[prefixedEventName] =
|
|
979
950
|
this._callbacks[prefixedEventName] || [];
|
|
@@ -981,8 +952,8 @@ var callback_registry_CallbackRegistry = (function () {
|
|
|
981
952
|
fn: callback,
|
|
982
953
|
context: context
|
|
983
954
|
});
|
|
984
|
-
}
|
|
985
|
-
|
|
955
|
+
}
|
|
956
|
+
remove(name, callback, context) {
|
|
986
957
|
if (!name && !callback && !context) {
|
|
987
958
|
this._callbacks = {};
|
|
988
959
|
return;
|
|
@@ -994,8 +965,8 @@ var callback_registry_CallbackRegistry = (function () {
|
|
|
994
965
|
else {
|
|
995
966
|
this.removeAllCallbacks(names);
|
|
996
967
|
}
|
|
997
|
-
}
|
|
998
|
-
|
|
968
|
+
}
|
|
969
|
+
removeCallback(names, callback, context) {
|
|
999
970
|
apply(names, function (name) {
|
|
1000
971
|
this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
|
|
1001
972
|
return ((callback && callback !== binding.fn) ||
|
|
@@ -1005,15 +976,13 @@ var callback_registry_CallbackRegistry = (function () {
|
|
|
1005
976
|
delete this._callbacks[name];
|
|
1006
977
|
}
|
|
1007
978
|
}, this);
|
|
1008
|
-
}
|
|
1009
|
-
|
|
979
|
+
}
|
|
980
|
+
removeAllCallbacks(names) {
|
|
1010
981
|
apply(names, function (name) {
|
|
1011
982
|
delete this._callbacks[name];
|
|
1012
983
|
}, this);
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
}());
|
|
1016
|
-
/* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
1017
986
|
function prefix(name) {
|
|
1018
987
|
return '_' + name;
|
|
1019
988
|
}
|
|
@@ -1021,38 +990,38 @@ function prefix(name) {
|
|
|
1021
990
|
// CONCATENATED MODULE: ./src/core/events/dispatcher.ts
|
|
1022
991
|
|
|
1023
992
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
this.callbacks = new
|
|
993
|
+
class dispatcher_Dispatcher {
|
|
994
|
+
constructor(failThrough) {
|
|
995
|
+
this.callbacks = new callback_registry_CallbackRegistry();
|
|
1027
996
|
this.global_callbacks = [];
|
|
1028
997
|
this.failThrough = failThrough;
|
|
1029
998
|
}
|
|
1030
|
-
|
|
999
|
+
bind(eventName, callback, context) {
|
|
1031
1000
|
this.callbacks.add(eventName, callback, context);
|
|
1032
1001
|
return this;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1002
|
+
}
|
|
1003
|
+
bind_global(callback) {
|
|
1035
1004
|
this.global_callbacks.push(callback);
|
|
1036
1005
|
return this;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1006
|
+
}
|
|
1007
|
+
unbind(eventName, callback, context) {
|
|
1039
1008
|
this.callbacks.remove(eventName, callback, context);
|
|
1040
1009
|
return this;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1010
|
+
}
|
|
1011
|
+
unbind_global(callback) {
|
|
1043
1012
|
if (!callback) {
|
|
1044
1013
|
this.global_callbacks = [];
|
|
1045
1014
|
return this;
|
|
1046
1015
|
}
|
|
1047
|
-
this.global_callbacks = filter(this.global_callbacks || [],
|
|
1016
|
+
this.global_callbacks = filter(this.global_callbacks || [], c => c !== callback);
|
|
1048
1017
|
return this;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1018
|
+
}
|
|
1019
|
+
unbind_all() {
|
|
1051
1020
|
this.unbind();
|
|
1052
1021
|
this.unbind_global();
|
|
1053
1022
|
return this;
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1023
|
+
}
|
|
1024
|
+
emit(eventName, data, metadata) {
|
|
1056
1025
|
for (var i = 0; i < this.global_callbacks.length; i++) {
|
|
1057
1026
|
this.global_callbacks[i](eventName, data);
|
|
1058
1027
|
}
|
|
@@ -1073,120 +1042,85 @@ var dispatcher_Dispatcher = (function () {
|
|
|
1073
1042
|
this.failThrough(eventName, data);
|
|
1074
1043
|
}
|
|
1075
1044
|
return this;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
}());
|
|
1079
|
-
/* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1080
1047
|
|
|
1081
1048
|
// CONCATENATED MODULE: ./src/core/logger.ts
|
|
1082
1049
|
|
|
1083
1050
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
this.globalLog =
|
|
1051
|
+
class logger_Logger {
|
|
1052
|
+
constructor() {
|
|
1053
|
+
this.globalLog = (message) => {
|
|
1087
1054
|
if (self.console && self.console.log) {
|
|
1088
1055
|
self.console.log(message);
|
|
1089
1056
|
}
|
|
1090
1057
|
};
|
|
1091
1058
|
}
|
|
1092
|
-
|
|
1093
|
-
var args = [];
|
|
1094
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1095
|
-
args[_i] = arguments[_i];
|
|
1096
|
-
}
|
|
1059
|
+
debug(...args) {
|
|
1097
1060
|
this.log(this.globalLog, args);
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
var args = [];
|
|
1101
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1102
|
-
args[_i] = arguments[_i];
|
|
1103
|
-
}
|
|
1061
|
+
}
|
|
1062
|
+
warn(...args) {
|
|
1104
1063
|
this.log(this.globalLogWarn, args);
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
var args = [];
|
|
1108
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1109
|
-
args[_i] = arguments[_i];
|
|
1110
|
-
}
|
|
1064
|
+
}
|
|
1065
|
+
error(...args) {
|
|
1111
1066
|
this.log(this.globalLogError, args);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1067
|
+
}
|
|
1068
|
+
globalLogWarn(message) {
|
|
1114
1069
|
if (self.console && self.console.warn) {
|
|
1115
1070
|
self.console.warn(message);
|
|
1116
1071
|
}
|
|
1117
1072
|
else {
|
|
1118
1073
|
this.globalLog(message);
|
|
1119
1074
|
}
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1075
|
+
}
|
|
1076
|
+
globalLogError(message) {
|
|
1122
1077
|
if (self.console && self.console.error) {
|
|
1123
1078
|
self.console.error(message);
|
|
1124
1079
|
}
|
|
1125
1080
|
else {
|
|
1126
1081
|
this.globalLogWarn(message);
|
|
1127
1082
|
}
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
var args = [];
|
|
1131
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1132
|
-
args[_i - 1] = arguments[_i];
|
|
1133
|
-
}
|
|
1083
|
+
}
|
|
1084
|
+
log(defaultLoggingFunction, ...args) {
|
|
1134
1085
|
var message = stringify.apply(this, arguments);
|
|
1135
1086
|
if (core_pusher.log) {
|
|
1136
1087
|
core_pusher.log(message);
|
|
1137
1088
|
}
|
|
1138
1089
|
else if (core_pusher.logToConsole) {
|
|
1139
|
-
|
|
1090
|
+
const log = defaultLoggingFunction.bind(this);
|
|
1140
1091
|
log(message);
|
|
1141
1092
|
}
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
}());
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1145
1095
|
/* harmony default export */ var logger = (new logger_Logger());
|
|
1146
1096
|
|
|
1147
1097
|
// CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
|
|
1148
|
-
var transport_connection_extends = (undefined && undefined.__extends) || (function () {
|
|
1149
|
-
var extendStatics = function (d, b) {
|
|
1150
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1151
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1152
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
1153
|
-
return extendStatics(d, b);
|
|
1154
|
-
};
|
|
1155
|
-
return function (d, b) {
|
|
1156
|
-
extendStatics(d, b);
|
|
1157
|
-
function __() { this.constructor = d; }
|
|
1158
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1159
|
-
};
|
|
1160
|
-
})();
|
|
1161
1098
|
|
|
1162
1099
|
|
|
1163
1100
|
|
|
1164
1101
|
|
|
1165
1102
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
_this.id = _this.timeline.generateUniqueID();
|
|
1180
|
-
return _this;
|
|
1103
|
+
class transport_connection_TransportConnection extends dispatcher_Dispatcher {
|
|
1104
|
+
constructor(hooks, name, priority, key, options) {
|
|
1105
|
+
super();
|
|
1106
|
+
this.initialize = worker_runtime.transportConnectionInitializer;
|
|
1107
|
+
this.hooks = hooks;
|
|
1108
|
+
this.name = name;
|
|
1109
|
+
this.priority = priority;
|
|
1110
|
+
this.key = key;
|
|
1111
|
+
this.options = options;
|
|
1112
|
+
this.state = 'new';
|
|
1113
|
+
this.timeline = options.timeline;
|
|
1114
|
+
this.activityTimeout = options.activityTimeout;
|
|
1115
|
+
this.id = this.timeline.generateUniqueID();
|
|
1181
1116
|
}
|
|
1182
|
-
|
|
1117
|
+
handlesActivityChecks() {
|
|
1183
1118
|
return Boolean(this.hooks.handlesActivityChecks);
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1119
|
+
}
|
|
1120
|
+
supportsPing() {
|
|
1186
1121
|
return Boolean(this.hooks.supportsPing);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
var _this = this;
|
|
1122
|
+
}
|
|
1123
|
+
connect() {
|
|
1190
1124
|
if (this.socket || this.state !== 'initialized') {
|
|
1191
1125
|
return false;
|
|
1192
1126
|
}
|
|
@@ -1195,18 +1129,18 @@ var transport_connection_TransportConnection = (function (_super) {
|
|
|
1195
1129
|
this.socket = this.hooks.getSocket(url, this.options);
|
|
1196
1130
|
}
|
|
1197
1131
|
catch (e) {
|
|
1198
|
-
util.defer(
|
|
1199
|
-
|
|
1200
|
-
|
|
1132
|
+
util.defer(() => {
|
|
1133
|
+
this.onError(e);
|
|
1134
|
+
this.changeState('closed');
|
|
1201
1135
|
});
|
|
1202
1136
|
return false;
|
|
1203
1137
|
}
|
|
1204
1138
|
this.bindListeners();
|
|
1205
|
-
logger.debug('Connecting', { transport: this.name, url
|
|
1139
|
+
logger.debug('Connecting', { transport: this.name, url });
|
|
1206
1140
|
this.changeState('connecting');
|
|
1207
1141
|
return true;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1142
|
+
}
|
|
1143
|
+
close() {
|
|
1210
1144
|
if (this.socket) {
|
|
1211
1145
|
this.socket.close();
|
|
1212
1146
|
return true;
|
|
@@ -1214,13 +1148,12 @@ var transport_connection_TransportConnection = (function (_super) {
|
|
|
1214
1148
|
else {
|
|
1215
1149
|
return false;
|
|
1216
1150
|
}
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
var _this = this;
|
|
1151
|
+
}
|
|
1152
|
+
send(data) {
|
|
1220
1153
|
if (this.state === 'open') {
|
|
1221
|
-
util.defer(
|
|
1222
|
-
if (
|
|
1223
|
-
|
|
1154
|
+
util.defer(() => {
|
|
1155
|
+
if (this.socket) {
|
|
1156
|
+
this.socket.send(data);
|
|
1224
1157
|
}
|
|
1225
1158
|
});
|
|
1226
1159
|
return true;
|
|
@@ -1228,24 +1161,24 @@ var transport_connection_TransportConnection = (function (_super) {
|
|
|
1228
1161
|
else {
|
|
1229
1162
|
return false;
|
|
1230
1163
|
}
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1164
|
+
}
|
|
1165
|
+
ping() {
|
|
1233
1166
|
if (this.state === 'open' && this.supportsPing()) {
|
|
1234
1167
|
this.socket.ping();
|
|
1235
1168
|
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1169
|
+
}
|
|
1170
|
+
onOpen() {
|
|
1238
1171
|
if (this.hooks.beforeOpen) {
|
|
1239
1172
|
this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
|
|
1240
1173
|
}
|
|
1241
1174
|
this.changeState('open');
|
|
1242
1175
|
this.socket.onopen = undefined;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1176
|
+
}
|
|
1177
|
+
onError(error) {
|
|
1245
1178
|
this.emit('error', { type: 'WebSocketError', error: error });
|
|
1246
1179
|
this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1180
|
+
}
|
|
1181
|
+
onClose(closeEvent) {
|
|
1249
1182
|
if (closeEvent) {
|
|
1250
1183
|
this.changeState('closed', {
|
|
1251
1184
|
code: closeEvent.code,
|
|
@@ -1258,34 +1191,33 @@ var transport_connection_TransportConnection = (function (_super) {
|
|
|
1258
1191
|
}
|
|
1259
1192
|
this.unbindListeners();
|
|
1260
1193
|
this.socket = undefined;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1194
|
+
}
|
|
1195
|
+
onMessage(message) {
|
|
1263
1196
|
this.emit('message', message);
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1197
|
+
}
|
|
1198
|
+
onActivity() {
|
|
1266
1199
|
this.emit('activity');
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
_this.onOpen();
|
|
1200
|
+
}
|
|
1201
|
+
bindListeners() {
|
|
1202
|
+
this.socket.onopen = () => {
|
|
1203
|
+
this.onOpen();
|
|
1272
1204
|
};
|
|
1273
|
-
this.socket.onerror =
|
|
1274
|
-
|
|
1205
|
+
this.socket.onerror = error => {
|
|
1206
|
+
this.onError(error);
|
|
1275
1207
|
};
|
|
1276
|
-
this.socket.onclose =
|
|
1277
|
-
|
|
1208
|
+
this.socket.onclose = closeEvent => {
|
|
1209
|
+
this.onClose(closeEvent);
|
|
1278
1210
|
};
|
|
1279
|
-
this.socket.onmessage =
|
|
1280
|
-
|
|
1211
|
+
this.socket.onmessage = message => {
|
|
1212
|
+
this.onMessage(message);
|
|
1281
1213
|
};
|
|
1282
1214
|
if (this.supportsPing()) {
|
|
1283
|
-
this.socket.onactivity =
|
|
1284
|
-
|
|
1215
|
+
this.socket.onactivity = () => {
|
|
1216
|
+
this.onActivity();
|
|
1285
1217
|
};
|
|
1286
1218
|
}
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1219
|
+
}
|
|
1220
|
+
unbindListeners() {
|
|
1289
1221
|
if (this.socket) {
|
|
1290
1222
|
this.socket.onopen = undefined;
|
|
1291
1223
|
this.socket.onerror = undefined;
|
|
@@ -1295,44 +1227,40 @@ var transport_connection_TransportConnection = (function (_super) {
|
|
|
1295
1227
|
this.socket.onactivity = undefined;
|
|
1296
1228
|
}
|
|
1297
1229
|
}
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1230
|
+
}
|
|
1231
|
+
changeState(state, params) {
|
|
1300
1232
|
this.state = state;
|
|
1301
1233
|
this.timeline.info(this.buildTimelineMessage({
|
|
1302
1234
|
state: state,
|
|
1303
1235
|
params: params
|
|
1304
1236
|
}));
|
|
1305
1237
|
this.emit(state, params);
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1238
|
+
}
|
|
1239
|
+
buildTimelineMessage(message) {
|
|
1308
1240
|
return extend({ cid: this.id }, message);
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
}(dispatcher));
|
|
1312
|
-
/* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1313
1243
|
|
|
1314
1244
|
// CONCATENATED MODULE: ./src/core/transports/transport.ts
|
|
1315
1245
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1246
|
+
class transport_Transport {
|
|
1247
|
+
constructor(hooks) {
|
|
1318
1248
|
this.hooks = hooks;
|
|
1319
1249
|
}
|
|
1320
|
-
|
|
1250
|
+
isSupported(environment) {
|
|
1321
1251
|
return this.hooks.isSupported(environment);
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
return new
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
}());
|
|
1328
|
-
/* harmony default export */ var transports_transport = (transport_Transport);
|
|
1252
|
+
}
|
|
1253
|
+
createConnection(name, priority, key, options) {
|
|
1254
|
+
return new transport_connection_TransportConnection(this.hooks, name, priority, key, options);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1329
1257
|
|
|
1330
1258
|
// CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
|
|
1331
1259
|
|
|
1332
1260
|
|
|
1333
1261
|
|
|
1334
1262
|
|
|
1335
|
-
var WSTransport = new
|
|
1263
|
+
var WSTransport = new transport_Transport({
|
|
1336
1264
|
urls: ws,
|
|
1337
1265
|
handlesActivityChecks: false,
|
|
1338
1266
|
supportsPing: false,
|
|
@@ -1369,8 +1297,8 @@ var xhrConfiguration = {
|
|
|
1369
1297
|
return worker_runtime.isXHRSupported();
|
|
1370
1298
|
}
|
|
1371
1299
|
};
|
|
1372
|
-
var XHRStreamingTransport = new
|
|
1373
|
-
var XHRPollingTransport = new
|
|
1300
|
+
var XHRStreamingTransport = new transport_Transport((extend({}, streamingConfiguration, xhrConfiguration)));
|
|
1301
|
+
var XHRPollingTransport = new transport_Transport(extend({}, pollingConfiguration, xhrConfiguration));
|
|
1374
1302
|
var Transports = {
|
|
1375
1303
|
ws: WSTransport,
|
|
1376
1304
|
xhr_streaming: XHRStreamingTransport,
|
|
@@ -1381,16 +1309,15 @@ var Transports = {
|
|
|
1381
1309
|
// CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
|
|
1382
1310
|
|
|
1383
1311
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1312
|
+
class assistant_to_the_transport_manager_AssistantToTheTransportManager {
|
|
1313
|
+
constructor(manager, transport, options) {
|
|
1386
1314
|
this.manager = manager;
|
|
1387
1315
|
this.transport = transport;
|
|
1388
1316
|
this.minPingDelay = options.minPingDelay;
|
|
1389
1317
|
this.maxPingDelay = options.maxPingDelay;
|
|
1390
1318
|
this.pingDelay = undefined;
|
|
1391
1319
|
}
|
|
1392
|
-
|
|
1393
|
-
var _this = this;
|
|
1320
|
+
createConnection(name, priority, key, options) {
|
|
1394
1321
|
options = extend({}, options, {
|
|
1395
1322
|
activityTimeout: this.pingDelay
|
|
1396
1323
|
});
|
|
@@ -1401,31 +1328,29 @@ var assistant_to_the_transport_manager_AssistantToTheTransportManager = (functio
|
|
|
1401
1328
|
connection.bind('closed', onClosed);
|
|
1402
1329
|
openTimestamp = util.now();
|
|
1403
1330
|
};
|
|
1404
|
-
var onClosed =
|
|
1331
|
+
var onClosed = closeEvent => {
|
|
1405
1332
|
connection.unbind('closed', onClosed);
|
|
1406
1333
|
if (closeEvent.code === 1002 || closeEvent.code === 1003) {
|
|
1407
|
-
|
|
1334
|
+
this.manager.reportDeath();
|
|
1408
1335
|
}
|
|
1409
1336
|
else if (!closeEvent.wasClean && openTimestamp) {
|
|
1410
1337
|
var lifespan = util.now() - openTimestamp;
|
|
1411
|
-
if (lifespan < 2 *
|
|
1412
|
-
|
|
1413
|
-
|
|
1338
|
+
if (lifespan < 2 * this.maxPingDelay) {
|
|
1339
|
+
this.manager.reportDeath();
|
|
1340
|
+
this.pingDelay = Math.max(lifespan / 2, this.minPingDelay);
|
|
1414
1341
|
}
|
|
1415
1342
|
}
|
|
1416
1343
|
};
|
|
1417
1344
|
connection.bind('open', onOpen);
|
|
1418
1345
|
return connection;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1346
|
+
}
|
|
1347
|
+
isSupported(environment) {
|
|
1421
1348
|
return this.manager.isAlive() && this.transport.isSupported(environment);
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
}());
|
|
1425
|
-
/* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1426
1351
|
|
|
1427
1352
|
// CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
|
|
1428
|
-
|
|
1353
|
+
const Protocol = {
|
|
1429
1354
|
decodeMessage: function (messageEvent) {
|
|
1430
1355
|
try {
|
|
1431
1356
|
var messageData = JSON.parse(messageEvent.data);
|
|
@@ -1518,68 +1443,52 @@ var Protocol = {
|
|
|
1518
1443
|
/* harmony default export */ var protocol = (Protocol);
|
|
1519
1444
|
|
|
1520
1445
|
// CONCATENATED MODULE: ./src/core/connection/connection.ts
|
|
1521
|
-
var connection_extends = (undefined && undefined.__extends) || (function () {
|
|
1522
|
-
var extendStatics = function (d, b) {
|
|
1523
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1524
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1525
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
1526
|
-
return extendStatics(d, b);
|
|
1527
|
-
};
|
|
1528
|
-
return function (d, b) {
|
|
1529
|
-
extendStatics(d, b);
|
|
1530
|
-
function __() { this.constructor = d; }
|
|
1531
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1532
|
-
};
|
|
1533
|
-
})();
|
|
1534
1446
|
|
|
1535
1447
|
|
|
1536
1448
|
|
|
1537
1449
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
_this.bindListeners();
|
|
1546
|
-
return _this;
|
|
1450
|
+
class connection_Connection extends dispatcher_Dispatcher {
|
|
1451
|
+
constructor(id, transport) {
|
|
1452
|
+
super();
|
|
1453
|
+
this.id = id;
|
|
1454
|
+
this.transport = transport;
|
|
1455
|
+
this.activityTimeout = transport.activityTimeout;
|
|
1456
|
+
this.bindListeners();
|
|
1547
1457
|
}
|
|
1548
|
-
|
|
1458
|
+
handlesActivityChecks() {
|
|
1549
1459
|
return this.transport.handlesActivityChecks();
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1460
|
+
}
|
|
1461
|
+
send(data) {
|
|
1552
1462
|
return this.transport.send(data);
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1463
|
+
}
|
|
1464
|
+
send_event(name, data, channel) {
|
|
1555
1465
|
var event = { event: name, data: data };
|
|
1556
1466
|
if (channel) {
|
|
1557
1467
|
event.channel = channel;
|
|
1558
1468
|
}
|
|
1559
1469
|
logger.debug('Event sent', event);
|
|
1560
1470
|
return this.send(protocol.encodeMessage(event));
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1471
|
+
}
|
|
1472
|
+
ping() {
|
|
1563
1473
|
if (this.transport.supportsPing()) {
|
|
1564
1474
|
this.transport.ping();
|
|
1565
1475
|
}
|
|
1566
1476
|
else {
|
|
1567
1477
|
this.send_event('pusher:ping', {});
|
|
1568
1478
|
}
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1479
|
+
}
|
|
1480
|
+
close() {
|
|
1571
1481
|
this.transport.close();
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
var _this = this;
|
|
1482
|
+
}
|
|
1483
|
+
bindListeners() {
|
|
1575
1484
|
var listeners = {
|
|
1576
|
-
message:
|
|
1485
|
+
message: (messageEvent) => {
|
|
1577
1486
|
var pusherEvent;
|
|
1578
1487
|
try {
|
|
1579
1488
|
pusherEvent = protocol.decodeMessage(messageEvent);
|
|
1580
1489
|
}
|
|
1581
1490
|
catch (e) {
|
|
1582
|
-
|
|
1491
|
+
this.emit('error', {
|
|
1583
1492
|
type: 'MessageParseError',
|
|
1584
1493
|
error: e,
|
|
1585
1494
|
data: messageEvent.data
|
|
@@ -1589,46 +1498,46 @@ var connection_Connection = (function (_super) {
|
|
|
1589
1498
|
logger.debug('Event recd', pusherEvent);
|
|
1590
1499
|
switch (pusherEvent.event) {
|
|
1591
1500
|
case 'pusher:error':
|
|
1592
|
-
|
|
1501
|
+
this.emit('error', {
|
|
1593
1502
|
type: 'PusherError',
|
|
1594
1503
|
data: pusherEvent.data
|
|
1595
1504
|
});
|
|
1596
1505
|
break;
|
|
1597
1506
|
case 'pusher:ping':
|
|
1598
|
-
|
|
1507
|
+
this.emit('ping');
|
|
1599
1508
|
break;
|
|
1600
1509
|
case 'pusher:pong':
|
|
1601
|
-
|
|
1510
|
+
this.emit('pong');
|
|
1602
1511
|
break;
|
|
1603
1512
|
}
|
|
1604
|
-
|
|
1513
|
+
this.emit('message', pusherEvent);
|
|
1605
1514
|
}
|
|
1606
1515
|
},
|
|
1607
|
-
activity:
|
|
1608
|
-
|
|
1516
|
+
activity: () => {
|
|
1517
|
+
this.emit('activity');
|
|
1609
1518
|
},
|
|
1610
|
-
error:
|
|
1611
|
-
|
|
1519
|
+
error: error => {
|
|
1520
|
+
this.emit('error', error);
|
|
1612
1521
|
},
|
|
1613
|
-
closed:
|
|
1522
|
+
closed: closeEvent => {
|
|
1614
1523
|
unbindListeners();
|
|
1615
1524
|
if (closeEvent && closeEvent.code) {
|
|
1616
|
-
|
|
1525
|
+
this.handleCloseEvent(closeEvent);
|
|
1617
1526
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1527
|
+
this.transport = null;
|
|
1528
|
+
this.emit('closed');
|
|
1620
1529
|
}
|
|
1621
1530
|
};
|
|
1622
|
-
var unbindListeners =
|
|
1623
|
-
objectApply(listeners,
|
|
1624
|
-
|
|
1531
|
+
var unbindListeners = () => {
|
|
1532
|
+
objectApply(listeners, (listener, event) => {
|
|
1533
|
+
this.transport.unbind(event, listener);
|
|
1625
1534
|
});
|
|
1626
1535
|
};
|
|
1627
|
-
objectApply(listeners,
|
|
1628
|
-
|
|
1536
|
+
objectApply(listeners, (listener, event) => {
|
|
1537
|
+
this.transport.bind(event, listener);
|
|
1629
1538
|
});
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1539
|
+
}
|
|
1540
|
+
handleCloseEvent(closeEvent) {
|
|
1632
1541
|
var action = protocol.getCloseAction(closeEvent);
|
|
1633
1542
|
var error = protocol.getCloseError(closeEvent);
|
|
1634
1543
|
if (error) {
|
|
@@ -1637,203 +1546,138 @@ var connection_Connection = (function (_super) {
|
|
|
1637
1546
|
if (action) {
|
|
1638
1547
|
this.emit(action, { action: action, error: error });
|
|
1639
1548
|
}
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
}(dispatcher));
|
|
1643
|
-
/* harmony default export */ var connection_connection = (connection_Connection);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1644
1551
|
|
|
1645
1552
|
// CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
|
|
1646
1553
|
|
|
1647
1554
|
|
|
1648
1555
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1556
|
+
class handshake_Handshake {
|
|
1557
|
+
constructor(transport, callback) {
|
|
1651
1558
|
this.transport = transport;
|
|
1652
1559
|
this.callback = callback;
|
|
1653
1560
|
this.bindListeners();
|
|
1654
1561
|
}
|
|
1655
|
-
|
|
1562
|
+
close() {
|
|
1656
1563
|
this.unbindListeners();
|
|
1657
1564
|
this.transport.close();
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
_this.unbindListeners();
|
|
1565
|
+
}
|
|
1566
|
+
bindListeners() {
|
|
1567
|
+
this.onMessage = m => {
|
|
1568
|
+
this.unbindListeners();
|
|
1663
1569
|
var result;
|
|
1664
1570
|
try {
|
|
1665
1571
|
result = protocol.processHandshake(m);
|
|
1666
1572
|
}
|
|
1667
1573
|
catch (e) {
|
|
1668
|
-
|
|
1669
|
-
|
|
1574
|
+
this.finish('error', { error: e });
|
|
1575
|
+
this.transport.close();
|
|
1670
1576
|
return;
|
|
1671
1577
|
}
|
|
1672
1578
|
if (result.action === 'connected') {
|
|
1673
|
-
|
|
1674
|
-
connection: new
|
|
1579
|
+
this.finish('connected', {
|
|
1580
|
+
connection: new connection_Connection(result.id, this.transport),
|
|
1675
1581
|
activityTimeout: result.activityTimeout
|
|
1676
1582
|
});
|
|
1677
1583
|
}
|
|
1678
1584
|
else {
|
|
1679
|
-
|
|
1680
|
-
|
|
1585
|
+
this.finish(result.action, { error: result.error });
|
|
1586
|
+
this.transport.close();
|
|
1681
1587
|
}
|
|
1682
1588
|
};
|
|
1683
|
-
this.onClosed =
|
|
1684
|
-
|
|
1589
|
+
this.onClosed = closeEvent => {
|
|
1590
|
+
this.unbindListeners();
|
|
1685
1591
|
var action = protocol.getCloseAction(closeEvent) || 'backoff';
|
|
1686
1592
|
var error = protocol.getCloseError(closeEvent);
|
|
1687
|
-
|
|
1593
|
+
this.finish(action, { error: error });
|
|
1688
1594
|
};
|
|
1689
1595
|
this.transport.bind('message', this.onMessage);
|
|
1690
1596
|
this.transport.bind('closed', this.onClosed);
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1597
|
+
}
|
|
1598
|
+
unbindListeners() {
|
|
1693
1599
|
this.transport.unbind('message', this.onMessage);
|
|
1694
1600
|
this.transport.unbind('closed', this.onClosed);
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1601
|
+
}
|
|
1602
|
+
finish(action, params) {
|
|
1697
1603
|
this.callback(extend({ transport: this.transport, action: action }, params));
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
}());
|
|
1701
|
-
/* harmony default export */ var connection_handshake = (handshake_Handshake);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1702
1606
|
|
|
1703
1607
|
// CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
|
|
1704
1608
|
|
|
1705
|
-
|
|
1706
|
-
|
|
1609
|
+
class timeline_sender_TimelineSender {
|
|
1610
|
+
constructor(timeline, options) {
|
|
1707
1611
|
this.timeline = timeline;
|
|
1708
1612
|
this.options = options || {};
|
|
1709
1613
|
}
|
|
1710
|
-
|
|
1614
|
+
send(useTLS, callback) {
|
|
1711
1615
|
if (this.timeline.isEmpty()) {
|
|
1712
1616
|
return;
|
|
1713
1617
|
}
|
|
1714
1618
|
this.timeline.send(worker_runtime.TimelineTransport.getAgent(this, useTLS), callback);
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
}());
|
|
1718
|
-
/* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1719
1621
|
|
|
1720
1622
|
// CONCATENATED MODULE: ./src/core/errors.ts
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
}(Error));
|
|
1777
|
-
|
|
1778
|
-
var TransportClosed = (function (_super) {
|
|
1779
|
-
errors_extends(TransportClosed, _super);
|
|
1780
|
-
function TransportClosed(msg) {
|
|
1781
|
-
var _newTarget = this.constructor;
|
|
1782
|
-
var _this = _super.call(this, msg) || this;
|
|
1783
|
-
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
1784
|
-
return _this;
|
|
1785
|
-
}
|
|
1786
|
-
return TransportClosed;
|
|
1787
|
-
}(Error));
|
|
1788
|
-
|
|
1789
|
-
var UnsupportedFeature = (function (_super) {
|
|
1790
|
-
errors_extends(UnsupportedFeature, _super);
|
|
1791
|
-
function UnsupportedFeature(msg) {
|
|
1792
|
-
var _newTarget = this.constructor;
|
|
1793
|
-
var _this = _super.call(this, msg) || this;
|
|
1794
|
-
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
1795
|
-
return _this;
|
|
1796
|
-
}
|
|
1797
|
-
return UnsupportedFeature;
|
|
1798
|
-
}(Error));
|
|
1799
|
-
|
|
1800
|
-
var UnsupportedTransport = (function (_super) {
|
|
1801
|
-
errors_extends(UnsupportedTransport, _super);
|
|
1802
|
-
function UnsupportedTransport(msg) {
|
|
1803
|
-
var _newTarget = this.constructor;
|
|
1804
|
-
var _this = _super.call(this, msg) || this;
|
|
1805
|
-
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
1806
|
-
return _this;
|
|
1807
|
-
}
|
|
1808
|
-
return UnsupportedTransport;
|
|
1809
|
-
}(Error));
|
|
1810
|
-
|
|
1811
|
-
var UnsupportedStrategy = (function (_super) {
|
|
1812
|
-
errors_extends(UnsupportedStrategy, _super);
|
|
1813
|
-
function UnsupportedStrategy(msg) {
|
|
1814
|
-
var _newTarget = this.constructor;
|
|
1815
|
-
var _this = _super.call(this, msg) || this;
|
|
1816
|
-
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
1817
|
-
return _this;
|
|
1818
|
-
}
|
|
1819
|
-
return UnsupportedStrategy;
|
|
1820
|
-
}(Error));
|
|
1821
|
-
|
|
1822
|
-
var HTTPAuthError = (function (_super) {
|
|
1823
|
-
errors_extends(HTTPAuthError, _super);
|
|
1824
|
-
function HTTPAuthError(status, msg) {
|
|
1825
|
-
var _newTarget = this.constructor;
|
|
1826
|
-
var _this = _super.call(this, msg) || this;
|
|
1827
|
-
_this.status = status;
|
|
1828
|
-
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
1829
|
-
return _this;
|
|
1830
|
-
}
|
|
1831
|
-
return HTTPAuthError;
|
|
1832
|
-
}(Error));
|
|
1833
|
-
|
|
1623
|
+
class BadEventName extends Error {
|
|
1624
|
+
constructor(msg) {
|
|
1625
|
+
super(msg);
|
|
1626
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
class BadChannelName extends Error {
|
|
1630
|
+
constructor(msg) {
|
|
1631
|
+
super(msg);
|
|
1632
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
class RequestTimedOut extends Error {
|
|
1636
|
+
constructor(msg) {
|
|
1637
|
+
super(msg);
|
|
1638
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
class TransportPriorityTooLow extends Error {
|
|
1642
|
+
constructor(msg) {
|
|
1643
|
+
super(msg);
|
|
1644
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
class TransportClosed extends Error {
|
|
1648
|
+
constructor(msg) {
|
|
1649
|
+
super(msg);
|
|
1650
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
class UnsupportedFeature extends Error {
|
|
1654
|
+
constructor(msg) {
|
|
1655
|
+
super(msg);
|
|
1656
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
class UnsupportedTransport extends Error {
|
|
1660
|
+
constructor(msg) {
|
|
1661
|
+
super(msg);
|
|
1662
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
class UnsupportedStrategy extends Error {
|
|
1666
|
+
constructor(msg) {
|
|
1667
|
+
super(msg);
|
|
1668
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
class HTTPAuthError extends Error {
|
|
1672
|
+
constructor(status, msg) {
|
|
1673
|
+
super(msg);
|
|
1674
|
+
this.status = status;
|
|
1675
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1834
1678
|
|
|
1835
1679
|
// CONCATENATED MODULE: ./src/core/utils/url_store.ts
|
|
1836
|
-
|
|
1680
|
+
const urlStore = {
|
|
1837
1681
|
baseUrl: 'https://pusher.com',
|
|
1838
1682
|
urls: {
|
|
1839
1683
|
authenticationEndpoint: {
|
|
@@ -1853,12 +1697,12 @@ var urlStore = {
|
|
|
1853
1697
|
}
|
|
1854
1698
|
}
|
|
1855
1699
|
};
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1700
|
+
const buildLogSuffix = function (key) {
|
|
1701
|
+
const urlPrefix = 'See:';
|
|
1702
|
+
const urlObj = urlStore.urls[key];
|
|
1859
1703
|
if (!urlObj)
|
|
1860
1704
|
return '';
|
|
1861
|
-
|
|
1705
|
+
let url;
|
|
1862
1706
|
if (urlObj.fullUrl) {
|
|
1863
1707
|
url = urlObj.fullUrl;
|
|
1864
1708
|
}
|
|
@@ -1867,60 +1711,45 @@ var buildLogSuffix = function (key) {
|
|
|
1867
1711
|
}
|
|
1868
1712
|
if (!url)
|
|
1869
1713
|
return '';
|
|
1870
|
-
return urlPrefix
|
|
1714
|
+
return `${urlPrefix} ${url}`;
|
|
1871
1715
|
};
|
|
1872
|
-
/* harmony default export */ var url_store = ({ buildLogSuffix
|
|
1716
|
+
/* harmony default export */ var url_store = ({ buildLogSuffix });
|
|
1873
1717
|
|
|
1874
1718
|
// CONCATENATED MODULE: ./src/core/channels/channel.ts
|
|
1875
|
-
var channel_extends = (undefined && undefined.__extends) || (function () {
|
|
1876
|
-
var extendStatics = function (d, b) {
|
|
1877
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1878
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1879
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
1880
|
-
return extendStatics(d, b);
|
|
1881
|
-
};
|
|
1882
|
-
return function (d, b) {
|
|
1883
|
-
extendStatics(d, b);
|
|
1884
|
-
function __() { this.constructor = d; }
|
|
1885
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1886
|
-
};
|
|
1887
|
-
})();
|
|
1888
1719
|
|
|
1889
1720
|
|
|
1890
1721
|
|
|
1891
1722
|
|
|
1892
1723
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
var _this = _super.call(this, function (event, data) {
|
|
1724
|
+
class channel_Channel extends dispatcher_Dispatcher {
|
|
1725
|
+
constructor(name, pusher) {
|
|
1726
|
+
super(function (event, data) {
|
|
1897
1727
|
logger.debug('No callbacks on ' + name + ' for ' + event);
|
|
1898
|
-
})
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
Channel.prototype.authorize = function (socketId, callback) {
|
|
1728
|
+
});
|
|
1729
|
+
this.name = name;
|
|
1730
|
+
this.pusher = pusher;
|
|
1731
|
+
this.subscribed = false;
|
|
1732
|
+
this.subscriptionPending = false;
|
|
1733
|
+
this.subscriptionCancelled = false;
|
|
1734
|
+
}
|
|
1735
|
+
authorize(socketId, callback) {
|
|
1907
1736
|
return callback(null, { auth: '' });
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1737
|
+
}
|
|
1738
|
+
trigger(event, data) {
|
|
1910
1739
|
if (event.indexOf('client-') !== 0) {
|
|
1911
1740
|
throw new BadEventName("Event '" + event + "' does not start with 'client-'");
|
|
1912
1741
|
}
|
|
1913
1742
|
if (!this.subscribed) {
|
|
1914
1743
|
var suffix = url_store.buildLogSuffix('triggeringClientEvents');
|
|
1915
|
-
logger.warn(
|
|
1744
|
+
logger.warn(`Client event triggered before channel 'subscription_succeeded' event . ${suffix}`);
|
|
1916
1745
|
}
|
|
1917
1746
|
return this.pusher.send_event(event, data, this.name);
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1747
|
+
}
|
|
1748
|
+
disconnect() {
|
|
1920
1749
|
this.subscribed = false;
|
|
1921
1750
|
this.subscriptionPending = false;
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1751
|
+
}
|
|
1752
|
+
handleEvent(event) {
|
|
1924
1753
|
var eventName = event.event;
|
|
1925
1754
|
var data = event.data;
|
|
1926
1755
|
if (eventName === 'pusher_internal:subscription_succeeded') {
|
|
@@ -1933,8 +1762,8 @@ var channel_Channel = (function (_super) {
|
|
|
1933
1762
|
var metadata = {};
|
|
1934
1763
|
this.emit(eventName, data, metadata);
|
|
1935
1764
|
}
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1765
|
+
}
|
|
1766
|
+
handleSubscriptionSucceededEvent(event) {
|
|
1938
1767
|
this.subscriptionPending = false;
|
|
1939
1768
|
this.subscribed = true;
|
|
1940
1769
|
if (this.subscriptionCancelled) {
|
|
@@ -1943,91 +1772,69 @@ var channel_Channel = (function (_super) {
|
|
|
1943
1772
|
else {
|
|
1944
1773
|
this.emit('pusher:subscription_succeeded', event.data);
|
|
1945
1774
|
}
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1775
|
+
}
|
|
1776
|
+
handleSubscriptionCountEvent(event) {
|
|
1948
1777
|
if (event.data.subscription_count) {
|
|
1949
1778
|
this.subscriptionCount = event.data.subscription_count;
|
|
1950
1779
|
}
|
|
1951
1780
|
this.emit('pusher:subscription_count', event.data);
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
var _this = this;
|
|
1781
|
+
}
|
|
1782
|
+
subscribe() {
|
|
1955
1783
|
if (this.subscribed) {
|
|
1956
1784
|
return;
|
|
1957
1785
|
}
|
|
1958
1786
|
this.subscriptionPending = true;
|
|
1959
1787
|
this.subscriptionCancelled = false;
|
|
1960
|
-
this.authorize(this.pusher.connection.socket_id,
|
|
1788
|
+
this.authorize(this.pusher.connection.socket_id, (error, data) => {
|
|
1961
1789
|
if (error) {
|
|
1962
|
-
|
|
1790
|
+
this.subscriptionPending = false;
|
|
1963
1791
|
logger.error(error.toString());
|
|
1964
|
-
|
|
1792
|
+
this.emit('pusher:subscription_error', Object.assign({}, {
|
|
1965
1793
|
type: 'AuthError',
|
|
1966
1794
|
error: error.message
|
|
1967
1795
|
}, error instanceof HTTPAuthError ? { status: error.status } : {}));
|
|
1968
1796
|
}
|
|
1969
1797
|
else {
|
|
1970
|
-
|
|
1798
|
+
this.pusher.send_event('pusher:subscribe', {
|
|
1971
1799
|
auth: data.auth,
|
|
1972
1800
|
channel_data: data.channel_data,
|
|
1973
|
-
channel:
|
|
1801
|
+
channel: this.name
|
|
1974
1802
|
});
|
|
1975
1803
|
}
|
|
1976
1804
|
});
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1805
|
+
}
|
|
1806
|
+
unsubscribe() {
|
|
1979
1807
|
this.subscribed = false;
|
|
1980
1808
|
this.pusher.send_event('pusher:unsubscribe', {
|
|
1981
1809
|
channel: this.name
|
|
1982
1810
|
});
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1811
|
+
}
|
|
1812
|
+
cancelSubscription() {
|
|
1985
1813
|
this.subscriptionCancelled = true;
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1814
|
+
}
|
|
1815
|
+
reinstateSubscription() {
|
|
1988
1816
|
this.subscriptionCancelled = false;
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
}(dispatcher));
|
|
1992
|
-
/* harmony default export */ var channels_channel = (channel_Channel);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1993
1819
|
|
|
1994
1820
|
// CONCATENATED MODULE: ./src/core/channels/private_channel.ts
|
|
1995
|
-
var private_channel_extends = (undefined && undefined.__extends) || (function () {
|
|
1996
|
-
var extendStatics = function (d, b) {
|
|
1997
|
-
extendStatics = Object.setPrototypeOf ||
|
|
1998
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1999
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2000
|
-
return extendStatics(d, b);
|
|
2001
|
-
};
|
|
2002
|
-
return function (d, b) {
|
|
2003
|
-
extendStatics(d, b);
|
|
2004
|
-
function __() { this.constructor = d; }
|
|
2005
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2006
|
-
};
|
|
2007
|
-
})();
|
|
2008
1821
|
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
function PrivateChannel() {
|
|
2012
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2013
|
-
}
|
|
2014
|
-
PrivateChannel.prototype.authorize = function (socketId, callback) {
|
|
1822
|
+
class private_channel_PrivateChannel extends channel_Channel {
|
|
1823
|
+
authorize(socketId, callback) {
|
|
2015
1824
|
return this.pusher.config.channelAuthorizer({
|
|
2016
1825
|
channelName: this.name,
|
|
2017
1826
|
socketId: socketId
|
|
2018
1827
|
}, callback);
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
}(channels_channel));
|
|
2022
|
-
/* harmony default export */ var private_channel = (PrivateChannel);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
2023
1830
|
|
|
2024
1831
|
// CONCATENATED MODULE: ./src/core/channels/members.ts
|
|
2025
1832
|
|
|
2026
|
-
|
|
2027
|
-
|
|
1833
|
+
class members_Members {
|
|
1834
|
+
constructor() {
|
|
2028
1835
|
this.reset();
|
|
2029
1836
|
}
|
|
2030
|
-
|
|
1837
|
+
get(id) {
|
|
2031
1838
|
if (Object.prototype.hasOwnProperty.call(this.members, id)) {
|
|
2032
1839
|
return {
|
|
2033
1840
|
id: id,
|
|
@@ -2037,60 +1844,44 @@ var members_Members = (function () {
|
|
|
2037
1844
|
else {
|
|
2038
1845
|
return null;
|
|
2039
1846
|
}
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
callback(_this.get(id));
|
|
1847
|
+
}
|
|
1848
|
+
each(callback) {
|
|
1849
|
+
objectApply(this.members, (member, id) => {
|
|
1850
|
+
callback(this.get(id));
|
|
2045
1851
|
});
|
|
2046
|
-
}
|
|
2047
|
-
|
|
1852
|
+
}
|
|
1853
|
+
setMyID(id) {
|
|
2048
1854
|
this.myID = id;
|
|
2049
|
-
}
|
|
2050
|
-
|
|
1855
|
+
}
|
|
1856
|
+
onSubscription(subscriptionData) {
|
|
2051
1857
|
this.members = subscriptionData.presence.hash;
|
|
2052
1858
|
this.count = subscriptionData.presence.count;
|
|
2053
1859
|
this.me = this.get(this.myID);
|
|
2054
|
-
}
|
|
2055
|
-
|
|
1860
|
+
}
|
|
1861
|
+
addMember(memberData) {
|
|
2056
1862
|
if (this.get(memberData.user_id) === null) {
|
|
2057
1863
|
this.count++;
|
|
2058
1864
|
}
|
|
2059
1865
|
this.members[memberData.user_id] = memberData.user_info;
|
|
2060
1866
|
return this.get(memberData.user_id);
|
|
2061
|
-
}
|
|
2062
|
-
|
|
1867
|
+
}
|
|
1868
|
+
removeMember(memberData) {
|
|
2063
1869
|
var member = this.get(memberData.user_id);
|
|
2064
1870
|
if (member) {
|
|
2065
1871
|
delete this.members[memberData.user_id];
|
|
2066
1872
|
this.count--;
|
|
2067
1873
|
}
|
|
2068
1874
|
return member;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
1875
|
+
}
|
|
1876
|
+
reset() {
|
|
2071
1877
|
this.members = {};
|
|
2072
1878
|
this.count = 0;
|
|
2073
1879
|
this.myID = null;
|
|
2074
1880
|
this.me = null;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
}());
|
|
2078
|
-
/* harmony default export */ var members = (members_Members);
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
2079
1883
|
|
|
2080
1884
|
// CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
|
|
2081
|
-
var presence_channel_extends = (undefined && undefined.__extends) || (function () {
|
|
2082
|
-
var extendStatics = function (d, b) {
|
|
2083
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2084
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2085
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2086
|
-
return extendStatics(d, b);
|
|
2087
|
-
};
|
|
2088
|
-
return function (d, b) {
|
|
2089
|
-
extendStatics(d, b);
|
|
2090
|
-
function __() { this.constructor = d; }
|
|
2091
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2092
|
-
};
|
|
2093
|
-
})();
|
|
2094
1885
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2095
1886
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2096
1887
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -2100,80 +1891,42 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
2100
1891
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2101
1892
|
});
|
|
2102
1893
|
};
|
|
2103
|
-
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
2104
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2105
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2106
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2107
|
-
function step(op) {
|
|
2108
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
2109
|
-
while (_) try {
|
|
2110
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2111
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2112
|
-
switch (op[0]) {
|
|
2113
|
-
case 0: case 1: t = op; break;
|
|
2114
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
2115
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2116
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2117
|
-
default:
|
|
2118
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2119
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2120
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2121
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2122
|
-
if (t[2]) _.ops.pop();
|
|
2123
|
-
_.trys.pop(); continue;
|
|
2124
|
-
}
|
|
2125
|
-
op = body.call(thisArg, _);
|
|
2126
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2127
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2128
|
-
}
|
|
2129
|
-
};
|
|
2130
1894
|
|
|
2131
1895
|
|
|
2132
1896
|
|
|
2133
1897
|
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
switch (_a.label) {
|
|
2147
|
-
case 0:
|
|
2148
|
-
if (!!error) return [3, 3];
|
|
2149
|
-
authData = authData;
|
|
2150
|
-
if (!(authData.channel_data != null)) return [3, 1];
|
|
2151
|
-
channelData = JSON.parse(authData.channel_data);
|
|
2152
|
-
this.members.setMyID(channelData.user_id);
|
|
2153
|
-
return [3, 3];
|
|
2154
|
-
case 1: return [4, this.pusher.user.signinDonePromise];
|
|
2155
|
-
case 2:
|
|
2156
|
-
_a.sent();
|
|
2157
|
-
if (this.pusher.user.user_data != null) {
|
|
2158
|
-
this.members.setMyID(this.pusher.user.user_data.id);
|
|
2159
|
-
}
|
|
2160
|
-
else {
|
|
2161
|
-
suffix = url_store.buildLogSuffix('authorizationEndpoint');
|
|
2162
|
-
logger.error("Invalid auth response for channel '" + this.name + "', " +
|
|
2163
|
-
("expected 'channel_data' field. " + suffix + ", ") +
|
|
2164
|
-
"or the user should be signed in.");
|
|
2165
|
-
callback('Invalid auth response');
|
|
2166
|
-
return [2];
|
|
2167
|
-
}
|
|
2168
|
-
_a.label = 3;
|
|
2169
|
-
case 3:
|
|
2170
|
-
callback(error, authData);
|
|
2171
|
-
return [2];
|
|
1898
|
+
class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
|
|
1899
|
+
constructor(name, pusher) {
|
|
1900
|
+
super(name, pusher);
|
|
1901
|
+
this.members = new members_Members();
|
|
1902
|
+
}
|
|
1903
|
+
authorize(socketId, callback) {
|
|
1904
|
+
super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
|
|
1905
|
+
if (!error) {
|
|
1906
|
+
authData = authData;
|
|
1907
|
+
if (authData.channel_data != null) {
|
|
1908
|
+
var channelData = JSON.parse(authData.channel_data);
|
|
1909
|
+
this.members.setMyID(channelData.user_id);
|
|
2172
1910
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
1911
|
+
else {
|
|
1912
|
+
yield this.pusher.user.signinDonePromise;
|
|
1913
|
+
if (this.pusher.user.user_data != null) {
|
|
1914
|
+
this.members.setMyID(this.pusher.user.user_data.id);
|
|
1915
|
+
}
|
|
1916
|
+
else {
|
|
1917
|
+
let suffix = url_store.buildLogSuffix('authorizationEndpoint');
|
|
1918
|
+
logger.error(`Invalid auth response for channel '${this.name}', ` +
|
|
1919
|
+
`expected 'channel_data' field. ${suffix}, ` +
|
|
1920
|
+
`or the user should be signed in.`);
|
|
1921
|
+
callback('Invalid auth response');
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
callback(error, authData);
|
|
1927
|
+
}));
|
|
1928
|
+
}
|
|
1929
|
+
handleEvent(event) {
|
|
2177
1930
|
var eventName = event.event;
|
|
2178
1931
|
if (eventName.indexOf('pusher_internal:') === 0) {
|
|
2179
1932
|
this.handleInternalEvent(event);
|
|
@@ -2186,8 +1939,8 @@ var presence_channel_PresenceChannel = (function (_super) {
|
|
|
2186
1939
|
}
|
|
2187
1940
|
this.emit(eventName, data, metadata);
|
|
2188
1941
|
}
|
|
2189
|
-
}
|
|
2190
|
-
|
|
1942
|
+
}
|
|
1943
|
+
handleInternalEvent(event) {
|
|
2191
1944
|
var eventName = event.event;
|
|
2192
1945
|
var data = event.data;
|
|
2193
1946
|
switch (eventName) {
|
|
@@ -2208,8 +1961,8 @@ var presence_channel_PresenceChannel = (function (_super) {
|
|
|
2208
1961
|
}
|
|
2209
1962
|
break;
|
|
2210
1963
|
}
|
|
2211
|
-
}
|
|
2212
|
-
|
|
1964
|
+
}
|
|
1965
|
+
handleSubscriptionSucceededEvent(event) {
|
|
2213
1966
|
this.subscriptionPending = false;
|
|
2214
1967
|
this.subscribed = true;
|
|
2215
1968
|
if (this.subscriptionCancelled) {
|
|
@@ -2219,14 +1972,12 @@ var presence_channel_PresenceChannel = (function (_super) {
|
|
|
2219
1972
|
this.members.onSubscription(event.data);
|
|
2220
1973
|
this.emit('pusher:subscription_succeeded', this.members);
|
|
2221
1974
|
}
|
|
2222
|
-
}
|
|
2223
|
-
|
|
1975
|
+
}
|
|
1976
|
+
disconnect() {
|
|
2224
1977
|
this.members.reset();
|
|
2225
|
-
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
}(private_channel));
|
|
2229
|
-
/* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
|
|
1978
|
+
super.disconnect();
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
2230
1981
|
|
|
2231
1982
|
// EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
|
|
2232
1983
|
var utf8 = __webpack_require__(1);
|
|
@@ -2235,64 +1986,47 @@ var utf8 = __webpack_require__(1);
|
|
|
2235
1986
|
var base64 = __webpack_require__(0);
|
|
2236
1987
|
|
|
2237
1988
|
// CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
|
|
2238
|
-
var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
|
|
2239
|
-
var extendStatics = function (d, b) {
|
|
2240
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2241
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2242
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2243
|
-
return extendStatics(d, b);
|
|
2244
|
-
};
|
|
2245
|
-
return function (d, b) {
|
|
2246
|
-
extendStatics(d, b);
|
|
2247
|
-
function __() { this.constructor = d; }
|
|
2248
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2249
|
-
};
|
|
2250
|
-
})();
|
|
2251
1989
|
|
|
2252
1990
|
|
|
2253
1991
|
|
|
2254
1992
|
|
|
2255
1993
|
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
_this.nacl = nacl;
|
|
2262
|
-
return _this;
|
|
1994
|
+
class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
|
|
1995
|
+
constructor(name, pusher, nacl) {
|
|
1996
|
+
super(name, pusher);
|
|
1997
|
+
this.key = null;
|
|
1998
|
+
this.nacl = nacl;
|
|
2263
1999
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
_super.prototype.authorize.call(this, socketId, function (error, authData) {
|
|
2000
|
+
authorize(socketId, callback) {
|
|
2001
|
+
super.authorize(socketId, (error, authData) => {
|
|
2267
2002
|
if (error) {
|
|
2268
2003
|
callback(error, authData);
|
|
2269
2004
|
return;
|
|
2270
2005
|
}
|
|
2271
|
-
|
|
2006
|
+
let sharedSecret = authData['shared_secret'];
|
|
2272
2007
|
if (!sharedSecret) {
|
|
2273
|
-
callback(new Error(
|
|
2008
|
+
callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
2274
2009
|
return;
|
|
2275
2010
|
}
|
|
2276
|
-
|
|
2011
|
+
this.key = Object(base64["decode"])(sharedSecret);
|
|
2277
2012
|
delete authData['shared_secret'];
|
|
2278
2013
|
callback(null, authData);
|
|
2279
2014
|
});
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2015
|
+
}
|
|
2016
|
+
trigger(event, data) {
|
|
2282
2017
|
throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2018
|
+
}
|
|
2019
|
+
handleEvent(event) {
|
|
2285
2020
|
var eventName = event.event;
|
|
2286
2021
|
var data = event.data;
|
|
2287
2022
|
if (eventName.indexOf('pusher_internal:') === 0 ||
|
|
2288
2023
|
eventName.indexOf('pusher:') === 0) {
|
|
2289
|
-
|
|
2024
|
+
super.handleEvent(event);
|
|
2290
2025
|
return;
|
|
2291
2026
|
}
|
|
2292
2027
|
this.handleEncryptedEvent(eventName, data);
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
var _this = this;
|
|
2028
|
+
}
|
|
2029
|
+
handleEncryptedEvent(event, data) {
|
|
2296
2030
|
if (!this.key) {
|
|
2297
2031
|
logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
|
|
2298
2032
|
return;
|
|
@@ -2302,98 +2036,81 @@ var encrypted_channel_EncryptedChannel = (function (_super) {
|
|
|
2302
2036
|
data);
|
|
2303
2037
|
return;
|
|
2304
2038
|
}
|
|
2305
|
-
|
|
2039
|
+
let cipherText = Object(base64["decode"])(data.ciphertext);
|
|
2306
2040
|
if (cipherText.length < this.nacl.secretbox.overheadLength) {
|
|
2307
|
-
logger.error(
|
|
2041
|
+
logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
|
|
2308
2042
|
return;
|
|
2309
2043
|
}
|
|
2310
|
-
|
|
2044
|
+
let nonce = Object(base64["decode"])(data.nonce);
|
|
2311
2045
|
if (nonce.length < this.nacl.secretbox.nonceLength) {
|
|
2312
|
-
logger.error(
|
|
2046
|
+
logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
|
|
2313
2047
|
return;
|
|
2314
2048
|
}
|
|
2315
|
-
|
|
2049
|
+
let bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
|
|
2316
2050
|
if (bytes === null) {
|
|
2317
2051
|
logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
|
|
2318
|
-
this.authorize(this.pusher.connection.socket_id,
|
|
2052
|
+
this.authorize(this.pusher.connection.socket_id, (error, authData) => {
|
|
2319
2053
|
if (error) {
|
|
2320
|
-
logger.error(
|
|
2054
|
+
logger.error(`Failed to make a request to the authEndpoint: ${authData}. Unable to fetch new key, so dropping encrypted event`);
|
|
2321
2055
|
return;
|
|
2322
2056
|
}
|
|
2323
|
-
bytes =
|
|
2057
|
+
bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
|
|
2324
2058
|
if (bytes === null) {
|
|
2325
|
-
logger.error(
|
|
2059
|
+
logger.error(`Failed to decrypt event with new key. Dropping encrypted event`);
|
|
2326
2060
|
return;
|
|
2327
2061
|
}
|
|
2328
|
-
|
|
2062
|
+
this.emit(event, this.getDataToEmit(bytes));
|
|
2329
2063
|
return;
|
|
2330
2064
|
});
|
|
2331
2065
|
return;
|
|
2332
2066
|
}
|
|
2333
2067
|
this.emit(event, this.getDataToEmit(bytes));
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
|
|
2068
|
+
}
|
|
2069
|
+
getDataToEmit(bytes) {
|
|
2070
|
+
let raw = Object(utf8["decode"])(bytes);
|
|
2337
2071
|
try {
|
|
2338
2072
|
return JSON.parse(raw);
|
|
2339
2073
|
}
|
|
2340
2074
|
catch (_a) {
|
|
2341
2075
|
return raw;
|
|
2342
2076
|
}
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
}(private_channel));
|
|
2346
|
-
/* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2347
2079
|
|
|
2348
2080
|
// CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
|
|
2349
|
-
var connection_manager_extends = (undefined && undefined.__extends) || (function () {
|
|
2350
|
-
var extendStatics = function (d, b) {
|
|
2351
|
-
extendStatics = Object.setPrototypeOf ||
|
|
2352
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2353
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2354
|
-
return extendStatics(d, b);
|
|
2355
|
-
};
|
|
2356
|
-
return function (d, b) {
|
|
2357
|
-
extendStatics(d, b);
|
|
2358
|
-
function __() { this.constructor = d; }
|
|
2359
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2360
|
-
};
|
|
2361
|
-
})();
|
|
2362
2081
|
|
|
2363
2082
|
|
|
2364
2083
|
|
|
2365
2084
|
|
|
2366
2085
|
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
_this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
|
|
2086
|
+
class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
2087
|
+
constructor(key, options) {
|
|
2088
|
+
super();
|
|
2089
|
+
this.state = 'initialized';
|
|
2090
|
+
this.connection = null;
|
|
2091
|
+
this.key = key;
|
|
2092
|
+
this.options = options;
|
|
2093
|
+
this.timeline = this.options.timeline;
|
|
2094
|
+
this.usingTLS = this.options.useTLS;
|
|
2095
|
+
this.errorCallbacks = this.buildErrorCallbacks();
|
|
2096
|
+
this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks);
|
|
2097
|
+
this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
|
|
2380
2098
|
var Network = worker_runtime.getNetwork();
|
|
2381
|
-
Network.bind('online',
|
|
2382
|
-
|
|
2383
|
-
if (
|
|
2384
|
-
|
|
2099
|
+
Network.bind('online', () => {
|
|
2100
|
+
this.timeline.info({ netinfo: 'online' });
|
|
2101
|
+
if (this.state === 'connecting' || this.state === 'unavailable') {
|
|
2102
|
+
this.retryIn(0);
|
|
2385
2103
|
}
|
|
2386
2104
|
});
|
|
2387
|
-
Network.bind('offline',
|
|
2388
|
-
|
|
2389
|
-
if (
|
|
2390
|
-
|
|
2105
|
+
Network.bind('offline', () => {
|
|
2106
|
+
this.timeline.info({ netinfo: 'offline' });
|
|
2107
|
+
if (this.connection) {
|
|
2108
|
+
this.sendActivityCheck();
|
|
2391
2109
|
}
|
|
2392
2110
|
});
|
|
2393
|
-
|
|
2394
|
-
return _this;
|
|
2111
|
+
this.updateStrategy();
|
|
2395
2112
|
}
|
|
2396
|
-
|
|
2113
|
+
connect() {
|
|
2397
2114
|
if (this.connection || this.runner) {
|
|
2398
2115
|
return;
|
|
2399
2116
|
}
|
|
@@ -2404,59 +2121,58 @@ var connection_manager_ConnectionManager = (function (_super) {
|
|
|
2404
2121
|
this.updateState('connecting');
|
|
2405
2122
|
this.startConnecting();
|
|
2406
2123
|
this.setUnavailableTimer();
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2124
|
+
}
|
|
2125
|
+
send(data) {
|
|
2409
2126
|
if (this.connection) {
|
|
2410
2127
|
return this.connection.send(data);
|
|
2411
2128
|
}
|
|
2412
2129
|
else {
|
|
2413
2130
|
return false;
|
|
2414
2131
|
}
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2132
|
+
}
|
|
2133
|
+
send_event(name, data, channel) {
|
|
2417
2134
|
if (this.connection) {
|
|
2418
2135
|
return this.connection.send_event(name, data, channel);
|
|
2419
2136
|
}
|
|
2420
2137
|
else {
|
|
2421
2138
|
return false;
|
|
2422
2139
|
}
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2140
|
+
}
|
|
2141
|
+
disconnect() {
|
|
2425
2142
|
this.disconnectInternally();
|
|
2426
2143
|
this.updateState('disconnected');
|
|
2427
|
-
}
|
|
2428
|
-
|
|
2144
|
+
}
|
|
2145
|
+
isUsingTLS() {
|
|
2429
2146
|
return this.usingTLS;
|
|
2430
|
-
}
|
|
2431
|
-
|
|
2432
|
-
var
|
|
2433
|
-
var callback = function (error, handshake) {
|
|
2147
|
+
}
|
|
2148
|
+
startConnecting() {
|
|
2149
|
+
var callback = (error, handshake) => {
|
|
2434
2150
|
if (error) {
|
|
2435
|
-
|
|
2151
|
+
this.runner = this.strategy.connect(0, callback);
|
|
2436
2152
|
}
|
|
2437
2153
|
else {
|
|
2438
2154
|
if (handshake.action === 'error') {
|
|
2439
|
-
|
|
2155
|
+
this.emit('error', {
|
|
2440
2156
|
type: 'HandshakeError',
|
|
2441
2157
|
error: handshake.error
|
|
2442
2158
|
});
|
|
2443
|
-
|
|
2159
|
+
this.timeline.error({ handshakeError: handshake.error });
|
|
2444
2160
|
}
|
|
2445
2161
|
else {
|
|
2446
|
-
|
|
2447
|
-
|
|
2162
|
+
this.abortConnecting();
|
|
2163
|
+
this.handshakeCallbacks[handshake.action](handshake);
|
|
2448
2164
|
}
|
|
2449
2165
|
}
|
|
2450
2166
|
};
|
|
2451
2167
|
this.runner = this.strategy.connect(0, callback);
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2168
|
+
}
|
|
2169
|
+
abortConnecting() {
|
|
2454
2170
|
if (this.runner) {
|
|
2455
2171
|
this.runner.abort();
|
|
2456
2172
|
this.runner = null;
|
|
2457
2173
|
}
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2174
|
+
}
|
|
2175
|
+
disconnectInternally() {
|
|
2460
2176
|
this.abortConnecting();
|
|
2461
2177
|
this.clearRetryTimer();
|
|
2462
2178
|
this.clearUnavailableTimer();
|
|
@@ -2464,136 +2180,129 @@ var connection_manager_ConnectionManager = (function (_super) {
|
|
|
2464
2180
|
var connection = this.abandonConnection();
|
|
2465
2181
|
connection.close();
|
|
2466
2182
|
}
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2183
|
+
}
|
|
2184
|
+
updateStrategy() {
|
|
2469
2185
|
this.strategy = this.options.getStrategy({
|
|
2470
2186
|
key: this.key,
|
|
2471
2187
|
timeline: this.timeline,
|
|
2472
2188
|
useTLS: this.usingTLS
|
|
2473
2189
|
});
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
var _this = this;
|
|
2190
|
+
}
|
|
2191
|
+
retryIn(delay) {
|
|
2477
2192
|
this.timeline.info({ action: 'retry', delay: delay });
|
|
2478
2193
|
if (delay > 0) {
|
|
2479
2194
|
this.emit('connecting_in', Math.round(delay / 1000));
|
|
2480
2195
|
}
|
|
2481
|
-
this.retryTimer = new
|
|
2482
|
-
|
|
2483
|
-
|
|
2196
|
+
this.retryTimer = new timers_OneOffTimer(delay || 0, () => {
|
|
2197
|
+
this.disconnectInternally();
|
|
2198
|
+
this.connect();
|
|
2484
2199
|
});
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2200
|
+
}
|
|
2201
|
+
clearRetryTimer() {
|
|
2487
2202
|
if (this.retryTimer) {
|
|
2488
2203
|
this.retryTimer.ensureAborted();
|
|
2489
2204
|
this.retryTimer = null;
|
|
2490
2205
|
}
|
|
2491
|
-
}
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
_this.updateState('unavailable');
|
|
2206
|
+
}
|
|
2207
|
+
setUnavailableTimer() {
|
|
2208
|
+
this.unavailableTimer = new timers_OneOffTimer(this.options.unavailableTimeout, () => {
|
|
2209
|
+
this.updateState('unavailable');
|
|
2496
2210
|
});
|
|
2497
|
-
}
|
|
2498
|
-
|
|
2211
|
+
}
|
|
2212
|
+
clearUnavailableTimer() {
|
|
2499
2213
|
if (this.unavailableTimer) {
|
|
2500
2214
|
this.unavailableTimer.ensureAborted();
|
|
2501
2215
|
}
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
var _this = this;
|
|
2216
|
+
}
|
|
2217
|
+
sendActivityCheck() {
|
|
2505
2218
|
this.stopActivityCheck();
|
|
2506
2219
|
this.connection.ping();
|
|
2507
|
-
this.activityTimer = new
|
|
2508
|
-
|
|
2509
|
-
|
|
2220
|
+
this.activityTimer = new timers_OneOffTimer(this.options.pongTimeout, () => {
|
|
2221
|
+
this.timeline.error({ pong_timed_out: this.options.pongTimeout });
|
|
2222
|
+
this.retryIn(0);
|
|
2510
2223
|
});
|
|
2511
|
-
}
|
|
2512
|
-
|
|
2513
|
-
var _this = this;
|
|
2224
|
+
}
|
|
2225
|
+
resetActivityCheck() {
|
|
2514
2226
|
this.stopActivityCheck();
|
|
2515
2227
|
if (this.connection && !this.connection.handlesActivityChecks()) {
|
|
2516
|
-
this.activityTimer = new
|
|
2517
|
-
|
|
2228
|
+
this.activityTimer = new timers_OneOffTimer(this.activityTimeout, () => {
|
|
2229
|
+
this.sendActivityCheck();
|
|
2518
2230
|
});
|
|
2519
2231
|
}
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2232
|
+
}
|
|
2233
|
+
stopActivityCheck() {
|
|
2522
2234
|
if (this.activityTimer) {
|
|
2523
2235
|
this.activityTimer.ensureAborted();
|
|
2524
2236
|
}
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
var _this = this;
|
|
2237
|
+
}
|
|
2238
|
+
buildConnectionCallbacks(errorCallbacks) {
|
|
2528
2239
|
return extend({}, errorCallbacks, {
|
|
2529
|
-
message:
|
|
2530
|
-
|
|
2531
|
-
|
|
2240
|
+
message: message => {
|
|
2241
|
+
this.resetActivityCheck();
|
|
2242
|
+
this.emit('message', message);
|
|
2532
2243
|
},
|
|
2533
|
-
ping:
|
|
2534
|
-
|
|
2244
|
+
ping: () => {
|
|
2245
|
+
this.send_event('pusher:pong', {});
|
|
2535
2246
|
},
|
|
2536
|
-
activity:
|
|
2537
|
-
|
|
2247
|
+
activity: () => {
|
|
2248
|
+
this.resetActivityCheck();
|
|
2538
2249
|
},
|
|
2539
|
-
error:
|
|
2540
|
-
|
|
2250
|
+
error: error => {
|
|
2251
|
+
this.emit('error', error);
|
|
2541
2252
|
},
|
|
2542
|
-
closed:
|
|
2543
|
-
|
|
2544
|
-
if (
|
|
2545
|
-
|
|
2253
|
+
closed: () => {
|
|
2254
|
+
this.abandonConnection();
|
|
2255
|
+
if (this.shouldRetry()) {
|
|
2256
|
+
this.retryIn(1000);
|
|
2546
2257
|
}
|
|
2547
2258
|
}
|
|
2548
2259
|
});
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
|
-
var _this = this;
|
|
2260
|
+
}
|
|
2261
|
+
buildHandshakeCallbacks(errorCallbacks) {
|
|
2552
2262
|
return extend({}, errorCallbacks, {
|
|
2553
|
-
connected:
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2263
|
+
connected: (handshake) => {
|
|
2264
|
+
this.activityTimeout = Math.min(this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
|
|
2265
|
+
this.clearUnavailableTimer();
|
|
2266
|
+
this.setConnection(handshake.connection);
|
|
2267
|
+
this.socket_id = this.connection.id;
|
|
2268
|
+
this.updateState('connected', { socket_id: this.socket_id });
|
|
2559
2269
|
}
|
|
2560
2270
|
});
|
|
2561
|
-
}
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
return function (result) {
|
|
2271
|
+
}
|
|
2272
|
+
buildErrorCallbacks() {
|
|
2273
|
+
let withErrorEmitted = callback => {
|
|
2274
|
+
return (result) => {
|
|
2566
2275
|
if (result.error) {
|
|
2567
|
-
|
|
2276
|
+
this.emit('error', { type: 'WebSocketError', error: result.error });
|
|
2568
2277
|
}
|
|
2569
2278
|
callback(result);
|
|
2570
2279
|
};
|
|
2571
2280
|
};
|
|
2572
2281
|
return {
|
|
2573
|
-
tls_only: withErrorEmitted(
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2282
|
+
tls_only: withErrorEmitted(() => {
|
|
2283
|
+
this.usingTLS = true;
|
|
2284
|
+
this.updateStrategy();
|
|
2285
|
+
this.retryIn(0);
|
|
2577
2286
|
}),
|
|
2578
|
-
refused: withErrorEmitted(
|
|
2579
|
-
|
|
2287
|
+
refused: withErrorEmitted(() => {
|
|
2288
|
+
this.disconnect();
|
|
2580
2289
|
}),
|
|
2581
|
-
backoff: withErrorEmitted(
|
|
2582
|
-
|
|
2290
|
+
backoff: withErrorEmitted(() => {
|
|
2291
|
+
this.retryIn(1000);
|
|
2583
2292
|
}),
|
|
2584
|
-
retry: withErrorEmitted(
|
|
2585
|
-
|
|
2293
|
+
retry: withErrorEmitted(() => {
|
|
2294
|
+
this.retryIn(0);
|
|
2586
2295
|
})
|
|
2587
2296
|
};
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2297
|
+
}
|
|
2298
|
+
setConnection(connection) {
|
|
2590
2299
|
this.connection = connection;
|
|
2591
2300
|
for (var event in this.connectionCallbacks) {
|
|
2592
2301
|
this.connection.bind(event, this.connectionCallbacks[event]);
|
|
2593
2302
|
}
|
|
2594
2303
|
this.resetActivityCheck();
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2304
|
+
}
|
|
2305
|
+
abandonConnection() {
|
|
2597
2306
|
if (!this.connection) {
|
|
2598
2307
|
return;
|
|
2599
2308
|
}
|
|
@@ -2604,8 +2313,8 @@ var connection_manager_ConnectionManager = (function (_super) {
|
|
|
2604
2313
|
var connection = this.connection;
|
|
2605
2314
|
this.connection = null;
|
|
2606
2315
|
return connection;
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2316
|
+
}
|
|
2317
|
+
updateState(newState, data) {
|
|
2609
2318
|
var previousState = this.state;
|
|
2610
2319
|
this.state = newState;
|
|
2611
2320
|
if (previousState !== newState) {
|
|
@@ -2618,56 +2327,52 @@ var connection_manager_ConnectionManager = (function (_super) {
|
|
|
2618
2327
|
this.emit('state_change', { previous: previousState, current: newState });
|
|
2619
2328
|
this.emit(newState, data);
|
|
2620
2329
|
}
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2330
|
+
}
|
|
2331
|
+
shouldRetry() {
|
|
2623
2332
|
return this.state === 'connecting' || this.state === 'connected';
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
}(dispatcher));
|
|
2627
|
-
/* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2628
2335
|
|
|
2629
2336
|
// CONCATENATED MODULE: ./src/core/channels/channels.ts
|
|
2630
2337
|
|
|
2631
2338
|
|
|
2632
2339
|
|
|
2633
2340
|
|
|
2634
|
-
|
|
2635
|
-
|
|
2341
|
+
class channels_Channels {
|
|
2342
|
+
constructor() {
|
|
2636
2343
|
this.channels = {};
|
|
2637
2344
|
}
|
|
2638
|
-
|
|
2345
|
+
add(name, pusher) {
|
|
2639
2346
|
if (!this.channels[name]) {
|
|
2640
2347
|
this.channels[name] = createChannel(name, pusher);
|
|
2641
2348
|
}
|
|
2642
2349
|
return this.channels[name];
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2350
|
+
}
|
|
2351
|
+
all() {
|
|
2645
2352
|
return values(this.channels);
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2353
|
+
}
|
|
2354
|
+
find(name) {
|
|
2648
2355
|
return this.channels[name];
|
|
2649
|
-
}
|
|
2650
|
-
|
|
2356
|
+
}
|
|
2357
|
+
remove(name) {
|
|
2651
2358
|
var channel = this.channels[name];
|
|
2652
2359
|
delete this.channels[name];
|
|
2653
2360
|
return channel;
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2361
|
+
}
|
|
2362
|
+
disconnect() {
|
|
2656
2363
|
objectApply(this.channels, function (channel) {
|
|
2657
2364
|
channel.disconnect();
|
|
2658
2365
|
});
|
|
2659
|
-
}
|
|
2660
|
-
|
|
2661
|
-
}());
|
|
2662
|
-
/* harmony default export */ var channels = (channels_Channels);
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2663
2368
|
function createChannel(name, pusher) {
|
|
2664
2369
|
if (name.indexOf('private-encrypted-') === 0) {
|
|
2665
2370
|
if (pusher.config.nacl) {
|
|
2666
2371
|
return factory.createEncryptedChannel(name, pusher, pusher.config.nacl);
|
|
2667
2372
|
}
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
throw new UnsupportedFeature(errMsg
|
|
2373
|
+
let errMsg = 'Tried to subscribe to a private-encrypted- channel but no nacl implementation available';
|
|
2374
|
+
let suffix = url_store.buildLogSuffix('encryptedChannelSupport');
|
|
2375
|
+
throw new UnsupportedFeature(`${errMsg}. ${suffix}`);
|
|
2671
2376
|
}
|
|
2672
2377
|
else if (name.indexOf('private-') === 0) {
|
|
2673
2378
|
return factory.createPrivateChannel(name, pusher);
|
|
@@ -2694,97 +2399,94 @@ function createChannel(name, pusher) {
|
|
|
2694
2399
|
|
|
2695
2400
|
|
|
2696
2401
|
var Factory = {
|
|
2697
|
-
createChannels
|
|
2698
|
-
return new
|
|
2402
|
+
createChannels() {
|
|
2403
|
+
return new channels_Channels();
|
|
2699
2404
|
},
|
|
2700
|
-
createConnectionManager
|
|
2701
|
-
return new
|
|
2405
|
+
createConnectionManager(key, options) {
|
|
2406
|
+
return new connection_manager_ConnectionManager(key, options);
|
|
2702
2407
|
},
|
|
2703
|
-
createChannel
|
|
2704
|
-
return new
|
|
2408
|
+
createChannel(name, pusher) {
|
|
2409
|
+
return new channel_Channel(name, pusher);
|
|
2705
2410
|
},
|
|
2706
|
-
createPrivateChannel
|
|
2707
|
-
return new
|
|
2411
|
+
createPrivateChannel(name, pusher) {
|
|
2412
|
+
return new private_channel_PrivateChannel(name, pusher);
|
|
2708
2413
|
},
|
|
2709
|
-
createPresenceChannel
|
|
2710
|
-
return new
|
|
2414
|
+
createPresenceChannel(name, pusher) {
|
|
2415
|
+
return new presence_channel_PresenceChannel(name, pusher);
|
|
2711
2416
|
},
|
|
2712
|
-
createEncryptedChannel
|
|
2713
|
-
return new
|
|
2417
|
+
createEncryptedChannel(name, pusher, nacl) {
|
|
2418
|
+
return new encrypted_channel_EncryptedChannel(name, pusher, nacl);
|
|
2714
2419
|
},
|
|
2715
|
-
createTimelineSender
|
|
2716
|
-
return new
|
|
2420
|
+
createTimelineSender(timeline, options) {
|
|
2421
|
+
return new timeline_sender_TimelineSender(timeline, options);
|
|
2717
2422
|
},
|
|
2718
|
-
createHandshake
|
|
2719
|
-
return new
|
|
2423
|
+
createHandshake(transport, callback) {
|
|
2424
|
+
return new handshake_Handshake(transport, callback);
|
|
2720
2425
|
},
|
|
2721
|
-
createAssistantToTheTransportManager
|
|
2722
|
-
return new
|
|
2426
|
+
createAssistantToTheTransportManager(manager, transport, options) {
|
|
2427
|
+
return new assistant_to_the_transport_manager_AssistantToTheTransportManager(manager, transport, options);
|
|
2723
2428
|
}
|
|
2724
2429
|
};
|
|
2725
2430
|
/* harmony default export */ var factory = (Factory);
|
|
2726
2431
|
|
|
2727
2432
|
// CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
|
|
2728
2433
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2434
|
+
class transport_manager_TransportManager {
|
|
2435
|
+
constructor(options) {
|
|
2731
2436
|
this.options = options || {};
|
|
2732
2437
|
this.livesLeft = this.options.lives || Infinity;
|
|
2733
2438
|
}
|
|
2734
|
-
|
|
2439
|
+
getAssistant(transport) {
|
|
2735
2440
|
return factory.createAssistantToTheTransportManager(this, transport, {
|
|
2736
2441
|
minPingDelay: this.options.minPingDelay,
|
|
2737
2442
|
maxPingDelay: this.options.maxPingDelay
|
|
2738
2443
|
});
|
|
2739
|
-
}
|
|
2740
|
-
|
|
2444
|
+
}
|
|
2445
|
+
isAlive() {
|
|
2741
2446
|
return this.livesLeft > 0;
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2447
|
+
}
|
|
2448
|
+
reportDeath() {
|
|
2744
2449
|
this.livesLeft -= 1;
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
}());
|
|
2748
|
-
/* harmony default export */ var transport_manager = (transport_manager_TransportManager);
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2749
2452
|
|
|
2750
2453
|
// CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
|
|
2751
2454
|
|
|
2752
2455
|
|
|
2753
2456
|
|
|
2754
|
-
|
|
2755
|
-
|
|
2457
|
+
class sequential_strategy_SequentialStrategy {
|
|
2458
|
+
constructor(strategies, options) {
|
|
2756
2459
|
this.strategies = strategies;
|
|
2757
2460
|
this.loop = Boolean(options.loop);
|
|
2758
2461
|
this.failFast = Boolean(options.failFast);
|
|
2759
2462
|
this.timeout = options.timeout;
|
|
2760
2463
|
this.timeoutLimit = options.timeoutLimit;
|
|
2761
2464
|
}
|
|
2762
|
-
|
|
2465
|
+
isSupported() {
|
|
2763
2466
|
return any(this.strategies, util.method('isSupported'));
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
|
-
var _this = this;
|
|
2467
|
+
}
|
|
2468
|
+
connect(minPriority, callback) {
|
|
2767
2469
|
var strategies = this.strategies;
|
|
2768
2470
|
var current = 0;
|
|
2769
2471
|
var timeout = this.timeout;
|
|
2770
2472
|
var runner = null;
|
|
2771
|
-
var tryNextStrategy =
|
|
2473
|
+
var tryNextStrategy = (error, handshake) => {
|
|
2772
2474
|
if (handshake) {
|
|
2773
2475
|
callback(null, handshake);
|
|
2774
2476
|
}
|
|
2775
2477
|
else {
|
|
2776
2478
|
current = current + 1;
|
|
2777
|
-
if (
|
|
2479
|
+
if (this.loop) {
|
|
2778
2480
|
current = current % strategies.length;
|
|
2779
2481
|
}
|
|
2780
2482
|
if (current < strategies.length) {
|
|
2781
2483
|
if (timeout) {
|
|
2782
2484
|
timeout = timeout * 2;
|
|
2783
|
-
if (
|
|
2784
|
-
timeout = Math.min(timeout,
|
|
2485
|
+
if (this.timeoutLimit) {
|
|
2486
|
+
timeout = Math.min(timeout, this.timeoutLimit);
|
|
2785
2487
|
}
|
|
2786
2488
|
}
|
|
2787
|
-
runner =
|
|
2489
|
+
runner = this.tryStrategy(strategies[current], minPriority, { timeout, failFast: this.failFast }, tryNextStrategy);
|
|
2788
2490
|
}
|
|
2789
2491
|
else {
|
|
2790
2492
|
callback(true);
|
|
@@ -2803,12 +2505,12 @@ var sequential_strategy_SequentialStrategy = (function () {
|
|
|
2803
2505
|
}
|
|
2804
2506
|
}
|
|
2805
2507
|
};
|
|
2806
|
-
}
|
|
2807
|
-
|
|
2508
|
+
}
|
|
2509
|
+
tryStrategy(strategy, minPriority, options, callback) {
|
|
2808
2510
|
var timer = null;
|
|
2809
2511
|
var runner = null;
|
|
2810
2512
|
if (options.timeout > 0) {
|
|
2811
|
-
timer = new
|
|
2513
|
+
timer = new timers_OneOffTimer(options.timeout, function () {
|
|
2812
2514
|
runner.abort();
|
|
2813
2515
|
callback(true);
|
|
2814
2516
|
});
|
|
@@ -2833,22 +2535,20 @@ var sequential_strategy_SequentialStrategy = (function () {
|
|
|
2833
2535
|
runner.forceMinPriority(p);
|
|
2834
2536
|
}
|
|
2835
2537
|
};
|
|
2836
|
-
}
|
|
2837
|
-
|
|
2838
|
-
}());
|
|
2839
|
-
/* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2840
2540
|
|
|
2841
2541
|
// CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
|
|
2842
2542
|
|
|
2843
2543
|
|
|
2844
|
-
|
|
2845
|
-
|
|
2544
|
+
class best_connected_ever_strategy_BestConnectedEverStrategy {
|
|
2545
|
+
constructor(strategies) {
|
|
2846
2546
|
this.strategies = strategies;
|
|
2847
2547
|
}
|
|
2848
|
-
|
|
2548
|
+
isSupported() {
|
|
2849
2549
|
return any(this.strategies, util.method('isSupported'));
|
|
2850
|
-
}
|
|
2851
|
-
|
|
2550
|
+
}
|
|
2551
|
+
connect(minPriority, callback) {
|
|
2852
2552
|
return connect(this.strategies, minPriority, function (i, runners) {
|
|
2853
2553
|
return function (error, handshake) {
|
|
2854
2554
|
runners[i].error = error;
|
|
@@ -2864,10 +2564,8 @@ var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
|
|
|
2864
2564
|
callback(null, handshake);
|
|
2865
2565
|
};
|
|
2866
2566
|
});
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
}());
|
|
2870
|
-
/* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2871
2569
|
function connect(strategies, minPriority, callbackBuilder) {
|
|
2872
2570
|
var runners = map(strategies, function (strategy, i, _, rs) {
|
|
2873
2571
|
return strategy.connect(minPriority, callbackBuilder(i, rs));
|
|
@@ -2900,18 +2598,18 @@ function abortRunner(runner) {
|
|
|
2900
2598
|
|
|
2901
2599
|
|
|
2902
2600
|
|
|
2903
|
-
|
|
2904
|
-
|
|
2601
|
+
class cached_strategy_CachedStrategy {
|
|
2602
|
+
constructor(strategy, transports, options) {
|
|
2905
2603
|
this.strategy = strategy;
|
|
2906
2604
|
this.transports = transports;
|
|
2907
2605
|
this.ttl = options.ttl || 1800 * 1000;
|
|
2908
2606
|
this.usingTLS = options.useTLS;
|
|
2909
2607
|
this.timeline = options.timeline;
|
|
2910
2608
|
}
|
|
2911
|
-
|
|
2609
|
+
isSupported() {
|
|
2912
2610
|
return this.strategy.isSupported();
|
|
2913
|
-
}
|
|
2914
|
-
|
|
2611
|
+
}
|
|
2612
|
+
connect(minPriority, callback) {
|
|
2915
2613
|
var usingTLS = this.usingTLS;
|
|
2916
2614
|
var info = fetchTransportCache(usingTLS);
|
|
2917
2615
|
var strategies = [this.strategy];
|
|
@@ -2923,7 +2621,7 @@ var cached_strategy_CachedStrategy = (function () {
|
|
|
2923
2621
|
transport: info.transport,
|
|
2924
2622
|
latency: info.latency
|
|
2925
2623
|
});
|
|
2926
|
-
strategies.push(new
|
|
2624
|
+
strategies.push(new sequential_strategy_SequentialStrategy([transport], {
|
|
2927
2625
|
timeout: info.latency * 2 + 1000,
|
|
2928
2626
|
failFast: true
|
|
2929
2627
|
}));
|
|
@@ -2959,10 +2657,8 @@ var cached_strategy_CachedStrategy = (function () {
|
|
|
2959
2657
|
}
|
|
2960
2658
|
}
|
|
2961
2659
|
};
|
|
2962
|
-
}
|
|
2963
|
-
|
|
2964
|
-
}());
|
|
2965
|
-
/* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2966
2662
|
function getTransportCacheKey(usingTLS) {
|
|
2967
2663
|
return 'pusherTransport' + (usingTLS ? 'TLS' : 'NonTLS');
|
|
2968
2664
|
}
|
|
@@ -3008,19 +2704,18 @@ function flushTransportCache(usingTLS) {
|
|
|
3008
2704
|
|
|
3009
2705
|
// CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
|
|
3010
2706
|
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
var number = _a.delay;
|
|
2707
|
+
class delayed_strategy_DelayedStrategy {
|
|
2708
|
+
constructor(strategy, { delay: number }) {
|
|
3014
2709
|
this.strategy = strategy;
|
|
3015
2710
|
this.options = { delay: number };
|
|
3016
2711
|
}
|
|
3017
|
-
|
|
2712
|
+
isSupported() {
|
|
3018
2713
|
return this.strategy.isSupported();
|
|
3019
|
-
}
|
|
3020
|
-
|
|
2714
|
+
}
|
|
2715
|
+
connect(minPriority, callback) {
|
|
3021
2716
|
var strategy = this.strategy;
|
|
3022
2717
|
var runner;
|
|
3023
|
-
var timer = new
|
|
2718
|
+
var timer = new timers_OneOffTimer(this.options.delay, function () {
|
|
3024
2719
|
runner = strategy.connect(minPriority, callback);
|
|
3025
2720
|
});
|
|
3026
2721
|
return {
|
|
@@ -3037,39 +2732,35 @@ var delayed_strategy_DelayedStrategy = (function () {
|
|
|
3037
2732
|
}
|
|
3038
2733
|
}
|
|
3039
2734
|
};
|
|
3040
|
-
}
|
|
3041
|
-
|
|
3042
|
-
}());
|
|
3043
|
-
/* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
3044
2737
|
|
|
3045
2738
|
// CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
|
|
3046
|
-
|
|
3047
|
-
|
|
2739
|
+
class IfStrategy {
|
|
2740
|
+
constructor(test, trueBranch, falseBranch) {
|
|
3048
2741
|
this.test = test;
|
|
3049
2742
|
this.trueBranch = trueBranch;
|
|
3050
2743
|
this.falseBranch = falseBranch;
|
|
3051
2744
|
}
|
|
3052
|
-
|
|
2745
|
+
isSupported() {
|
|
3053
2746
|
var branch = this.test() ? this.trueBranch : this.falseBranch;
|
|
3054
2747
|
return branch.isSupported();
|
|
3055
|
-
}
|
|
3056
|
-
|
|
2748
|
+
}
|
|
2749
|
+
connect(minPriority, callback) {
|
|
3057
2750
|
var branch = this.test() ? this.trueBranch : this.falseBranch;
|
|
3058
2751
|
return branch.connect(minPriority, callback);
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
}());
|
|
3062
|
-
/* harmony default export */ var if_strategy = (IfStrategy);
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
3063
2754
|
|
|
3064
2755
|
// CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
|
|
3065
|
-
|
|
3066
|
-
|
|
2756
|
+
class FirstConnectedStrategy {
|
|
2757
|
+
constructor(strategy) {
|
|
3067
2758
|
this.strategy = strategy;
|
|
3068
2759
|
}
|
|
3069
|
-
|
|
2760
|
+
isSupported() {
|
|
3070
2761
|
return this.strategy.isSupported();
|
|
3071
|
-
}
|
|
3072
|
-
|
|
2762
|
+
}
|
|
2763
|
+
connect(minPriority, callback) {
|
|
3073
2764
|
var runner = this.strategy.connect(minPriority, function (error, handshake) {
|
|
3074
2765
|
if (handshake) {
|
|
3075
2766
|
runner.abort();
|
|
@@ -3077,10 +2768,8 @@ var FirstConnectedStrategy = (function () {
|
|
|
3077
2768
|
callback(error, handshake);
|
|
3078
2769
|
});
|
|
3079
2770
|
return runner;
|
|
3080
|
-
}
|
|
3081
|
-
|
|
3082
|
-
}());
|
|
3083
|
-
/* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
3084
2773
|
|
|
3085
2774
|
// CONCATENATED MODULE: ./src/runtimes/isomorphic/default_strategy.ts
|
|
3086
2775
|
|
|
@@ -3121,12 +2810,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
3121
2810
|
timeout: 15000,
|
|
3122
2811
|
timeoutLimit: 60000
|
|
3123
2812
|
};
|
|
3124
|
-
var ws_manager = new
|
|
3125
|
-
lives: 2,
|
|
2813
|
+
var ws_manager = new transport_manager_TransportManager({
|
|
3126
2814
|
minPingDelay: 10000,
|
|
3127
2815
|
maxPingDelay: config.activityTimeout
|
|
3128
2816
|
});
|
|
3129
|
-
var streaming_manager = new
|
|
2817
|
+
var streaming_manager = new transport_manager_TransportManager({
|
|
3130
2818
|
lives: 2,
|
|
3131
2819
|
minPingDelay: 10000,
|
|
3132
2820
|
maxPingDelay: config.activityTimeout
|
|
@@ -3135,31 +2823,31 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
3135
2823
|
var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager);
|
|
3136
2824
|
var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, http_options, streaming_manager);
|
|
3137
2825
|
var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, http_options);
|
|
3138
|
-
var ws_loop = new
|
|
3139
|
-
var wss_loop = new
|
|
3140
|
-
var streaming_loop = new
|
|
3141
|
-
var polling_loop = new
|
|
3142
|
-
var http_loop = new
|
|
3143
|
-
new
|
|
2826
|
+
var ws_loop = new sequential_strategy_SequentialStrategy([ws_transport], timeouts);
|
|
2827
|
+
var wss_loop = new sequential_strategy_SequentialStrategy([wss_transport], timeouts);
|
|
2828
|
+
var streaming_loop = new sequential_strategy_SequentialStrategy([xhr_streaming_transport], timeouts);
|
|
2829
|
+
var polling_loop = new sequential_strategy_SequentialStrategy([xhr_polling_transport], timeouts);
|
|
2830
|
+
var http_loop = new sequential_strategy_SequentialStrategy([
|
|
2831
|
+
new IfStrategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy_BestConnectedEverStrategy([
|
|
3144
2832
|
streaming_loop,
|
|
3145
|
-
new
|
|
2833
|
+
new delayed_strategy_DelayedStrategy(polling_loop, { delay: 4000 })
|
|
3146
2834
|
]), polling_loop)
|
|
3147
2835
|
], timeouts);
|
|
3148
2836
|
var wsStrategy;
|
|
3149
2837
|
if (baseOptions.useTLS) {
|
|
3150
|
-
wsStrategy = new
|
|
2838
|
+
wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
|
|
3151
2839
|
ws_loop,
|
|
3152
|
-
new
|
|
2840
|
+
new delayed_strategy_DelayedStrategy(http_loop, { delay: 2000 })
|
|
3153
2841
|
]);
|
|
3154
2842
|
}
|
|
3155
2843
|
else {
|
|
3156
|
-
wsStrategy = new
|
|
2844
|
+
wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
|
|
3157
2845
|
ws_loop,
|
|
3158
|
-
new
|
|
3159
|
-
new
|
|
2846
|
+
new delayed_strategy_DelayedStrategy(wss_loop, { delay: 2000 }),
|
|
2847
|
+
new delayed_strategy_DelayedStrategy(http_loop, { delay: 5000 })
|
|
3160
2848
|
]);
|
|
3161
2849
|
}
|
|
3162
|
-
return new
|
|
2850
|
+
return new cached_strategy_CachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
|
|
3163
2851
|
ttl: 1800000,
|
|
3164
2852
|
timeline: baseOptions.timeline,
|
|
3165
2853
|
useTLS: baseOptions.useTLS
|
|
@@ -3182,37 +2870,21 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
3182
2870
|
});
|
|
3183
2871
|
|
|
3184
2872
|
// CONCATENATED MODULE: ./src/core/http/http_request.ts
|
|
3185
|
-
var http_request_extends = (undefined && undefined.__extends) || (function () {
|
|
3186
|
-
var extendStatics = function (d, b) {
|
|
3187
|
-
extendStatics = Object.setPrototypeOf ||
|
|
3188
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3189
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
3190
|
-
return extendStatics(d, b);
|
|
3191
|
-
};
|
|
3192
|
-
return function (d, b) {
|
|
3193
|
-
extendStatics(d, b);
|
|
3194
|
-
function __() { this.constructor = d; }
|
|
3195
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3196
|
-
};
|
|
3197
|
-
})();
|
|
3198
2873
|
|
|
3199
2874
|
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
_this.url = url;
|
|
3208
|
-
return _this;
|
|
2875
|
+
const MAX_BUFFER_LENGTH = 256 * 1024;
|
|
2876
|
+
class http_request_HTTPRequest extends dispatcher_Dispatcher {
|
|
2877
|
+
constructor(hooks, method, url) {
|
|
2878
|
+
super();
|
|
2879
|
+
this.hooks = hooks;
|
|
2880
|
+
this.method = method;
|
|
2881
|
+
this.url = url;
|
|
3209
2882
|
}
|
|
3210
|
-
|
|
3211
|
-
var _this = this;
|
|
2883
|
+
start(payload) {
|
|
3212
2884
|
this.position = 0;
|
|
3213
2885
|
this.xhr = this.hooks.getRequest(this);
|
|
3214
|
-
this.unloader =
|
|
3215
|
-
|
|
2886
|
+
this.unloader = () => {
|
|
2887
|
+
this.close();
|
|
3216
2888
|
};
|
|
3217
2889
|
worker_runtime.addUnloadListener(this.unloader);
|
|
3218
2890
|
this.xhr.open(this.method, this.url, true);
|
|
@@ -3220,8 +2892,8 @@ var http_request_HTTPRequest = (function (_super) {
|
|
|
3220
2892
|
this.xhr.setRequestHeader('Content-Type', 'application/json');
|
|
3221
2893
|
}
|
|
3222
2894
|
this.xhr.send(payload);
|
|
3223
|
-
}
|
|
3224
|
-
|
|
2895
|
+
}
|
|
2896
|
+
close() {
|
|
3225
2897
|
if (this.unloader) {
|
|
3226
2898
|
worker_runtime.removeUnloadListener(this.unloader);
|
|
3227
2899
|
this.unloader = null;
|
|
@@ -3230,8 +2902,8 @@ var http_request_HTTPRequest = (function (_super) {
|
|
|
3230
2902
|
this.hooks.abortRequest(this.xhr);
|
|
3231
2903
|
this.xhr = null;
|
|
3232
2904
|
}
|
|
3233
|
-
}
|
|
3234
|
-
|
|
2905
|
+
}
|
|
2906
|
+
onChunk(status, data) {
|
|
3235
2907
|
while (true) {
|
|
3236
2908
|
var chunk = this.advanceBuffer(data);
|
|
3237
2909
|
if (chunk) {
|
|
@@ -3244,8 +2916,8 @@ var http_request_HTTPRequest = (function (_super) {
|
|
|
3244
2916
|
if (this.isBufferTooLong(data)) {
|
|
3245
2917
|
this.emit('buffer_too_long');
|
|
3246
2918
|
}
|
|
3247
|
-
}
|
|
3248
|
-
|
|
2919
|
+
}
|
|
2920
|
+
advanceBuffer(buffer) {
|
|
3249
2921
|
var unreadData = buffer.slice(this.position);
|
|
3250
2922
|
var endOfLinePosition = unreadData.indexOf('\n');
|
|
3251
2923
|
if (endOfLinePosition !== -1) {
|
|
@@ -3255,13 +2927,11 @@ var http_request_HTTPRequest = (function (_super) {
|
|
|
3255
2927
|
else {
|
|
3256
2928
|
return null;
|
|
3257
2929
|
}
|
|
3258
|
-
}
|
|
3259
|
-
|
|
2930
|
+
}
|
|
2931
|
+
isBufferTooLong(buffer) {
|
|
3260
2932
|
return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
}(dispatcher));
|
|
3264
|
-
/* harmony default export */ var http_request = (http_request_HTTPRequest);
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
3265
2935
|
|
|
3266
2936
|
// CONCATENATED MODULE: ./src/core/http/state.ts
|
|
3267
2937
|
var State;
|
|
@@ -3277,24 +2947,24 @@ var State;
|
|
|
3277
2947
|
|
|
3278
2948
|
|
|
3279
2949
|
var autoIncrement = 1;
|
|
3280
|
-
|
|
3281
|
-
|
|
2950
|
+
class http_socket_HTTPSocket {
|
|
2951
|
+
constructor(hooks, url) {
|
|
3282
2952
|
this.hooks = hooks;
|
|
3283
2953
|
this.session = randomNumber(1000) + '/' + randomString(8);
|
|
3284
2954
|
this.location = getLocation(url);
|
|
3285
2955
|
this.readyState = state.CONNECTING;
|
|
3286
2956
|
this.openStream();
|
|
3287
2957
|
}
|
|
3288
|
-
|
|
2958
|
+
send(payload) {
|
|
3289
2959
|
return this.sendRaw(JSON.stringify([payload]));
|
|
3290
|
-
}
|
|
3291
|
-
|
|
2960
|
+
}
|
|
2961
|
+
ping() {
|
|
3292
2962
|
this.hooks.sendHeartbeat(this);
|
|
3293
|
-
}
|
|
3294
|
-
|
|
2963
|
+
}
|
|
2964
|
+
close(code, reason) {
|
|
3295
2965
|
this.onClose(code, reason, true);
|
|
3296
|
-
}
|
|
3297
|
-
|
|
2966
|
+
}
|
|
2967
|
+
sendRaw(payload) {
|
|
3298
2968
|
if (this.readyState === state.OPEN) {
|
|
3299
2969
|
try {
|
|
3300
2970
|
worker_runtime.createSocketRequest('POST', getUniqueURL(getSendURL(this.location, this.session))).start(payload);
|
|
@@ -3307,12 +2977,12 @@ var http_socket_HTTPSocket = (function () {
|
|
|
3307
2977
|
else {
|
|
3308
2978
|
return false;
|
|
3309
2979
|
}
|
|
3310
|
-
}
|
|
3311
|
-
|
|
2980
|
+
}
|
|
2981
|
+
reconnect() {
|
|
3312
2982
|
this.closeStream();
|
|
3313
2983
|
this.openStream();
|
|
3314
|
-
}
|
|
3315
|
-
|
|
2984
|
+
}
|
|
2985
|
+
onClose(code, reason, wasClean) {
|
|
3316
2986
|
this.closeStream();
|
|
3317
2987
|
this.readyState = state.CLOSED;
|
|
3318
2988
|
if (this.onclose) {
|
|
@@ -3322,8 +2992,8 @@ var http_socket_HTTPSocket = (function () {
|
|
|
3322
2992
|
wasClean: wasClean
|
|
3323
2993
|
});
|
|
3324
2994
|
}
|
|
3325
|
-
}
|
|
3326
|
-
|
|
2995
|
+
}
|
|
2996
|
+
onChunk(chunk) {
|
|
3327
2997
|
if (chunk.status !== 200) {
|
|
3328
2998
|
return;
|
|
3329
2999
|
}
|
|
@@ -3355,8 +3025,8 @@ var http_socket_HTTPSocket = (function () {
|
|
|
3355
3025
|
this.onClose(payload[0], payload[1], true);
|
|
3356
3026
|
break;
|
|
3357
3027
|
}
|
|
3358
|
-
}
|
|
3359
|
-
|
|
3028
|
+
}
|
|
3029
|
+
onOpen(options) {
|
|
3360
3030
|
if (this.readyState === state.CONNECTING) {
|
|
3361
3031
|
if (options && options.hostname) {
|
|
3362
3032
|
this.location.base = replaceHost(this.location.base, options.hostname);
|
|
@@ -3369,53 +3039,51 @@ var http_socket_HTTPSocket = (function () {
|
|
|
3369
3039
|
else {
|
|
3370
3040
|
this.onClose(1006, 'Server lost session', true);
|
|
3371
3041
|
}
|
|
3372
|
-
}
|
|
3373
|
-
|
|
3042
|
+
}
|
|
3043
|
+
onEvent(event) {
|
|
3374
3044
|
if (this.readyState === state.OPEN && this.onmessage) {
|
|
3375
3045
|
this.onmessage({ data: event });
|
|
3376
3046
|
}
|
|
3377
|
-
}
|
|
3378
|
-
|
|
3047
|
+
}
|
|
3048
|
+
onActivity() {
|
|
3379
3049
|
if (this.onactivity) {
|
|
3380
3050
|
this.onactivity();
|
|
3381
3051
|
}
|
|
3382
|
-
}
|
|
3383
|
-
|
|
3052
|
+
}
|
|
3053
|
+
onError(error) {
|
|
3384
3054
|
if (this.onerror) {
|
|
3385
3055
|
this.onerror(error);
|
|
3386
3056
|
}
|
|
3387
|
-
}
|
|
3388
|
-
|
|
3389
|
-
var _this = this;
|
|
3057
|
+
}
|
|
3058
|
+
openStream() {
|
|
3390
3059
|
this.stream = worker_runtime.createSocketRequest('POST', getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
|
|
3391
|
-
this.stream.bind('chunk',
|
|
3392
|
-
|
|
3060
|
+
this.stream.bind('chunk', chunk => {
|
|
3061
|
+
this.onChunk(chunk);
|
|
3393
3062
|
});
|
|
3394
|
-
this.stream.bind('finished',
|
|
3395
|
-
|
|
3063
|
+
this.stream.bind('finished', status => {
|
|
3064
|
+
this.hooks.onFinished(this, status);
|
|
3396
3065
|
});
|
|
3397
|
-
this.stream.bind('buffer_too_long',
|
|
3398
|
-
|
|
3066
|
+
this.stream.bind('buffer_too_long', () => {
|
|
3067
|
+
this.reconnect();
|
|
3399
3068
|
});
|
|
3400
3069
|
try {
|
|
3401
3070
|
this.stream.start();
|
|
3402
3071
|
}
|
|
3403
3072
|
catch (error) {
|
|
3404
|
-
util.defer(
|
|
3405
|
-
|
|
3406
|
-
|
|
3073
|
+
util.defer(() => {
|
|
3074
|
+
this.onError(error);
|
|
3075
|
+
this.onClose(1006, 'Could not start streaming', false);
|
|
3407
3076
|
});
|
|
3408
3077
|
}
|
|
3409
|
-
}
|
|
3410
|
-
|
|
3078
|
+
}
|
|
3079
|
+
closeStream() {
|
|
3411
3080
|
if (this.stream) {
|
|
3412
3081
|
this.stream.unbind_all();
|
|
3413
3082
|
this.stream.close();
|
|
3414
3083
|
this.stream = null;
|
|
3415
3084
|
}
|
|
3416
|
-
}
|
|
3417
|
-
|
|
3418
|
-
}());
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3419
3087
|
function getLocation(url) {
|
|
3420
3088
|
var parts = /([^\?]*)\/*(\??.*)/.exec(url);
|
|
3421
3089
|
return {
|
|
@@ -3522,20 +3190,20 @@ var http_xhr_request_hooks = {
|
|
|
3522
3190
|
|
|
3523
3191
|
|
|
3524
3192
|
var HTTP = {
|
|
3525
|
-
createStreamingSocket
|
|
3193
|
+
createStreamingSocket(url) {
|
|
3526
3194
|
return this.createSocket(http_streaming_socket, url);
|
|
3527
3195
|
},
|
|
3528
|
-
createPollingSocket
|
|
3196
|
+
createPollingSocket(url) {
|
|
3529
3197
|
return this.createSocket(http_polling_socket, url);
|
|
3530
3198
|
},
|
|
3531
|
-
createSocket
|
|
3199
|
+
createSocket(hooks, url) {
|
|
3532
3200
|
return new http_socket(hooks, url);
|
|
3533
3201
|
},
|
|
3534
|
-
createXHR
|
|
3202
|
+
createXHR(method, url) {
|
|
3535
3203
|
return this.createRequest(http_xhr_request, method, url);
|
|
3536
3204
|
},
|
|
3537
|
-
createRequest
|
|
3538
|
-
return new
|
|
3205
|
+
createRequest(hooks, method, url) {
|
|
3206
|
+
return new http_request_HTTPRequest(hooks, method, url);
|
|
3539
3207
|
}
|
|
3540
3208
|
};
|
|
3541
3209
|
/* harmony default export */ var http_http = (HTTP);
|
|
@@ -3551,24 +3219,24 @@ var Isomorphic = {
|
|
|
3551
3219
|
Transports: transports,
|
|
3552
3220
|
transportConnectionInitializer: transport_connection_initializer,
|
|
3553
3221
|
HTTPFactory: http_http,
|
|
3554
|
-
setup
|
|
3222
|
+
setup(PusherClass) {
|
|
3555
3223
|
PusherClass.ready();
|
|
3556
3224
|
},
|
|
3557
|
-
getLocalStorage
|
|
3225
|
+
getLocalStorage() {
|
|
3558
3226
|
return undefined;
|
|
3559
3227
|
},
|
|
3560
|
-
getClientFeatures
|
|
3228
|
+
getClientFeatures() {
|
|
3561
3229
|
return keys(filterObject({ ws: transports.ws }, function (t) {
|
|
3562
3230
|
return t.isSupported({});
|
|
3563
3231
|
}));
|
|
3564
3232
|
},
|
|
3565
|
-
getProtocol
|
|
3233
|
+
getProtocol() {
|
|
3566
3234
|
return 'http:';
|
|
3567
3235
|
},
|
|
3568
|
-
isXHRSupported
|
|
3236
|
+
isXHRSupported() {
|
|
3569
3237
|
return true;
|
|
3570
3238
|
},
|
|
3571
|
-
createSocketRequest
|
|
3239
|
+
createSocketRequest(method, url) {
|
|
3572
3240
|
if (this.isXHRSupported()) {
|
|
3573
3241
|
return this.HTTPFactory.createXHR(method, url);
|
|
3574
3242
|
}
|
|
@@ -3576,46 +3244,27 @@ var Isomorphic = {
|
|
|
3576
3244
|
throw 'Cross-origin HTTP requests are not supported';
|
|
3577
3245
|
}
|
|
3578
3246
|
},
|
|
3579
|
-
createXHR
|
|
3247
|
+
createXHR() {
|
|
3580
3248
|
var Constructor = this.getXHRAPI();
|
|
3581
3249
|
return new Constructor();
|
|
3582
3250
|
},
|
|
3583
|
-
createWebSocket
|
|
3251
|
+
createWebSocket(url) {
|
|
3584
3252
|
var Constructor = this.getWebSocketAPI();
|
|
3585
3253
|
return new Constructor(url);
|
|
3586
3254
|
},
|
|
3587
|
-
addUnloadListener
|
|
3588
|
-
removeUnloadListener
|
|
3255
|
+
addUnloadListener(listener) { },
|
|
3256
|
+
removeUnloadListener(listener) { }
|
|
3589
3257
|
};
|
|
3590
3258
|
/* harmony default export */ var runtime = (Isomorphic);
|
|
3591
3259
|
|
|
3592
3260
|
// CONCATENATED MODULE: ./src/runtimes/worker/net_info.ts
|
|
3593
|
-
var net_info_extends = (undefined && undefined.__extends) || (function () {
|
|
3594
|
-
var extendStatics = function (d, b) {
|
|
3595
|
-
extendStatics = Object.setPrototypeOf ||
|
|
3596
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3597
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
3598
|
-
return extendStatics(d, b);
|
|
3599
|
-
};
|
|
3600
|
-
return function (d, b) {
|
|
3601
|
-
extendStatics(d, b);
|
|
3602
|
-
function __() { this.constructor = d; }
|
|
3603
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3604
|
-
};
|
|
3605
|
-
})();
|
|
3606
3261
|
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
function NetInfo() {
|
|
3610
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3611
|
-
}
|
|
3612
|
-
NetInfo.prototype.isOnline = function () {
|
|
3262
|
+
class net_info_NetInfo extends dispatcher_Dispatcher {
|
|
3263
|
+
isOnline() {
|
|
3613
3264
|
return true;
|
|
3614
|
-
}
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
var net_info_Network = new NetInfo();
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
var net_info_Network = new net_info_NetInfo();
|
|
3619
3268
|
|
|
3620
3269
|
// CONCATENATED MODULE: ./src/runtimes/worker/auth/fetch_auth.ts
|
|
3621
3270
|
|
|
@@ -3626,36 +3275,37 @@ var fetchAuth = function (context, query, authOptions, authRequestType, callback
|
|
|
3626
3275
|
headers.set(headerName, authOptions.headers[headerName]);
|
|
3627
3276
|
}
|
|
3628
3277
|
if (authOptions.headersProvider != null) {
|
|
3629
|
-
|
|
3278
|
+
const dynamicHeaders = authOptions.headersProvider();
|
|
3630
3279
|
for (var headerName in dynamicHeaders) {
|
|
3631
3280
|
headers.set(headerName, dynamicHeaders[headerName]);
|
|
3632
3281
|
}
|
|
3633
3282
|
}
|
|
3634
3283
|
var body = query;
|
|
3635
3284
|
var request = new Request(authOptions.endpoint, {
|
|
3636
|
-
headers
|
|
3637
|
-
body
|
|
3285
|
+
headers,
|
|
3286
|
+
body,
|
|
3638
3287
|
credentials: 'same-origin',
|
|
3639
3288
|
method: 'POST'
|
|
3640
3289
|
});
|
|
3641
3290
|
return fetch(request)
|
|
3642
|
-
.then(
|
|
3643
|
-
|
|
3291
|
+
.then(response => {
|
|
3292
|
+
let { status } = response;
|
|
3644
3293
|
if (status === 200) {
|
|
3645
3294
|
return response.text();
|
|
3646
3295
|
}
|
|
3647
|
-
throw new HTTPAuthError(status,
|
|
3296
|
+
throw new HTTPAuthError(status, `Could not get ${authRequestType.toString()} info from your auth endpoint, status: ${status}`);
|
|
3648
3297
|
})
|
|
3649
|
-
.then(
|
|
3650
|
-
|
|
3298
|
+
.then(data => {
|
|
3299
|
+
let parsedData;
|
|
3651
3300
|
try {
|
|
3652
3301
|
parsedData = JSON.parse(data);
|
|
3653
3302
|
}
|
|
3654
3303
|
catch (e) {
|
|
3655
|
-
throw new HTTPAuthError(200,
|
|
3304
|
+
throw new HTTPAuthError(200, `JSON returned from ${authRequestType.toString()} endpoint was invalid, yet status code was 200. Data was: ${data}`);
|
|
3656
3305
|
}
|
|
3657
3306
|
callback(null, parsedData);
|
|
3658
|
-
})
|
|
3307
|
+
})
|
|
3308
|
+
.catch(err => {
|
|
3659
3309
|
callback(err, null);
|
|
3660
3310
|
});
|
|
3661
3311
|
};
|
|
@@ -3671,25 +3321,25 @@ var getAgent = function (sender, useTLS) {
|
|
|
3671
3321
|
var query = buildQueryString(data);
|
|
3672
3322
|
url += '/' + 2 + '?' + query;
|
|
3673
3323
|
fetch(url)
|
|
3674
|
-
.then(
|
|
3324
|
+
.then(response => {
|
|
3675
3325
|
if (response.status !== 200) {
|
|
3676
|
-
throw
|
|
3326
|
+
throw `received ${response.status} from stats.pusher.com`;
|
|
3677
3327
|
}
|
|
3678
3328
|
return response.json();
|
|
3679
3329
|
})
|
|
3680
|
-
.then(
|
|
3681
|
-
var host = _a.host;
|
|
3330
|
+
.then(({ host }) => {
|
|
3682
3331
|
if (host) {
|
|
3683
3332
|
sender.host = host;
|
|
3684
3333
|
}
|
|
3685
|
-
})
|
|
3334
|
+
})
|
|
3335
|
+
.catch(err => {
|
|
3686
3336
|
logger.debug('TimelineSender Error: ', err);
|
|
3687
3337
|
});
|
|
3688
3338
|
};
|
|
3689
3339
|
};
|
|
3690
3340
|
var fetchTimeline = {
|
|
3691
3341
|
name: 'xhr',
|
|
3692
|
-
getAgent
|
|
3342
|
+
getAgent
|
|
3693
3343
|
};
|
|
3694
3344
|
/* harmony default export */ var fetch_timeline = (fetchTimeline);
|
|
3695
3345
|
|
|
@@ -3698,38 +3348,38 @@ var fetchTimeline = {
|
|
|
3698
3348
|
|
|
3699
3349
|
|
|
3700
3350
|
|
|
3701
|
-
|
|
3702
|
-
|
|
3351
|
+
const { getDefaultStrategy: runtime_getDefaultStrategy, Transports: runtime_Transports, setup, getProtocol, isXHRSupported, getLocalStorage, createXHR, createWebSocket, addUnloadListener, removeUnloadListener, transportConnectionInitializer, createSocketRequest, HTTPFactory } = runtime;
|
|
3352
|
+
const Worker = {
|
|
3703
3353
|
getDefaultStrategy: runtime_getDefaultStrategy,
|
|
3704
3354
|
Transports: runtime_Transports,
|
|
3705
|
-
setup
|
|
3706
|
-
getProtocol
|
|
3707
|
-
isXHRSupported
|
|
3708
|
-
getLocalStorage
|
|
3709
|
-
createXHR
|
|
3710
|
-
createWebSocket
|
|
3711
|
-
addUnloadListener
|
|
3712
|
-
removeUnloadListener
|
|
3713
|
-
transportConnectionInitializer
|
|
3714
|
-
createSocketRequest
|
|
3715
|
-
HTTPFactory
|
|
3355
|
+
setup,
|
|
3356
|
+
getProtocol,
|
|
3357
|
+
isXHRSupported,
|
|
3358
|
+
getLocalStorage,
|
|
3359
|
+
createXHR,
|
|
3360
|
+
createWebSocket,
|
|
3361
|
+
addUnloadListener,
|
|
3362
|
+
removeUnloadListener,
|
|
3363
|
+
transportConnectionInitializer,
|
|
3364
|
+
createSocketRequest,
|
|
3365
|
+
HTTPFactory,
|
|
3716
3366
|
TimelineTransport: fetch_timeline,
|
|
3717
|
-
getAuthorizers
|
|
3367
|
+
getAuthorizers() {
|
|
3718
3368
|
return { ajax: fetch_auth };
|
|
3719
3369
|
},
|
|
3720
|
-
getWebSocketAPI
|
|
3370
|
+
getWebSocketAPI() {
|
|
3721
3371
|
return WebSocket;
|
|
3722
3372
|
},
|
|
3723
|
-
getXHRAPI
|
|
3373
|
+
getXHRAPI() {
|
|
3724
3374
|
return XMLHttpRequest;
|
|
3725
3375
|
},
|
|
3726
|
-
getNetwork
|
|
3376
|
+
getNetwork() {
|
|
3727
3377
|
return net_info_Network;
|
|
3728
3378
|
},
|
|
3729
|
-
randomInt
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3379
|
+
randomInt(max) {
|
|
3380
|
+
const random = function () {
|
|
3381
|
+
const crypto = globalThis.crypto || globalThis['msCrypto'];
|
|
3382
|
+
const random = crypto.getRandomValues(new Uint32Array(1))[0];
|
|
3733
3383
|
return random / Math.pow(2, 32);
|
|
3734
3384
|
};
|
|
3735
3385
|
return Math.floor(random() * max);
|
|
@@ -3750,8 +3400,8 @@ var TimelineLevel;
|
|
|
3750
3400
|
|
|
3751
3401
|
|
|
3752
3402
|
|
|
3753
|
-
|
|
3754
|
-
|
|
3403
|
+
class timeline_Timeline {
|
|
3404
|
+
constructor(key, session, options) {
|
|
3755
3405
|
this.key = key;
|
|
3756
3406
|
this.session = session;
|
|
3757
3407
|
this.events = [];
|
|
@@ -3759,28 +3409,27 @@ var timeline_Timeline = (function () {
|
|
|
3759
3409
|
this.sent = 0;
|
|
3760
3410
|
this.uniqueID = 0;
|
|
3761
3411
|
}
|
|
3762
|
-
|
|
3412
|
+
log(level, event) {
|
|
3763
3413
|
if (level <= this.options.level) {
|
|
3764
3414
|
this.events.push(extend({}, event, { timestamp: util.now() }));
|
|
3765
3415
|
if (this.options.limit && this.events.length > this.options.limit) {
|
|
3766
3416
|
this.events.shift();
|
|
3767
3417
|
}
|
|
3768
3418
|
}
|
|
3769
|
-
}
|
|
3770
|
-
|
|
3419
|
+
}
|
|
3420
|
+
error(event) {
|
|
3771
3421
|
this.log(timeline_level.ERROR, event);
|
|
3772
|
-
}
|
|
3773
|
-
|
|
3422
|
+
}
|
|
3423
|
+
info(event) {
|
|
3774
3424
|
this.log(timeline_level.INFO, event);
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3425
|
+
}
|
|
3426
|
+
debug(event) {
|
|
3777
3427
|
this.log(timeline_level.DEBUG, event);
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3428
|
+
}
|
|
3429
|
+
isEmpty() {
|
|
3780
3430
|
return this.events.length === 0;
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
|
-
var _this = this;
|
|
3431
|
+
}
|
|
3432
|
+
send(sendfn, callback) {
|
|
3784
3433
|
var data = extend({
|
|
3785
3434
|
session: this.session,
|
|
3786
3435
|
bundle: this.sent + 1,
|
|
@@ -3792,43 +3441,40 @@ var timeline_Timeline = (function () {
|
|
|
3792
3441
|
timeline: this.events
|
|
3793
3442
|
}, this.options.params);
|
|
3794
3443
|
this.events = [];
|
|
3795
|
-
sendfn(data,
|
|
3444
|
+
sendfn(data, (error, result) => {
|
|
3796
3445
|
if (!error) {
|
|
3797
|
-
|
|
3446
|
+
this.sent++;
|
|
3798
3447
|
}
|
|
3799
3448
|
if (callback) {
|
|
3800
3449
|
callback(error, result);
|
|
3801
3450
|
}
|
|
3802
3451
|
});
|
|
3803
3452
|
return true;
|
|
3804
|
-
}
|
|
3805
|
-
|
|
3453
|
+
}
|
|
3454
|
+
generateUniqueID() {
|
|
3806
3455
|
this.uniqueID++;
|
|
3807
3456
|
return this.uniqueID;
|
|
3808
|
-
}
|
|
3809
|
-
|
|
3810
|
-
}());
|
|
3811
|
-
/* harmony default export */ var timeline_timeline = (timeline_Timeline);
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3812
3459
|
|
|
3813
3460
|
// CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
|
|
3814
3461
|
|
|
3815
3462
|
|
|
3816
3463
|
|
|
3817
3464
|
|
|
3818
|
-
|
|
3819
|
-
|
|
3465
|
+
class transport_strategy_TransportStrategy {
|
|
3466
|
+
constructor(name, priority, transport, options) {
|
|
3820
3467
|
this.name = name;
|
|
3821
3468
|
this.priority = priority;
|
|
3822
3469
|
this.transport = transport;
|
|
3823
3470
|
this.options = options || {};
|
|
3824
3471
|
}
|
|
3825
|
-
|
|
3472
|
+
isSupported() {
|
|
3826
3473
|
return this.transport.isSupported({
|
|
3827
3474
|
useTLS: this.options.useTLS
|
|
3828
3475
|
});
|
|
3829
|
-
}
|
|
3830
|
-
|
|
3831
|
-
var _this = this;
|
|
3476
|
+
}
|
|
3477
|
+
connect(minPriority, callback) {
|
|
3832
3478
|
if (!this.isSupported()) {
|
|
3833
3479
|
return failAttempt(new UnsupportedStrategy(), callback);
|
|
3834
3480
|
}
|
|
@@ -3871,7 +3517,7 @@ var transport_strategy_TransportStrategy = (function () {
|
|
|
3871
3517
|
transport.bind('closed', onClosed);
|
|
3872
3518
|
transport.initialize();
|
|
3873
3519
|
return {
|
|
3874
|
-
abort:
|
|
3520
|
+
abort: () => {
|
|
3875
3521
|
if (connected) {
|
|
3876
3522
|
return;
|
|
3877
3523
|
}
|
|
@@ -3883,11 +3529,11 @@ var transport_strategy_TransportStrategy = (function () {
|
|
|
3883
3529
|
transport.close();
|
|
3884
3530
|
}
|
|
3885
3531
|
},
|
|
3886
|
-
forceMinPriority:
|
|
3532
|
+
forceMinPriority: p => {
|
|
3887
3533
|
if (connected) {
|
|
3888
3534
|
return;
|
|
3889
3535
|
}
|
|
3890
|
-
if (
|
|
3536
|
+
if (this.priority < p) {
|
|
3891
3537
|
if (handshake) {
|
|
3892
3538
|
handshake.close();
|
|
3893
3539
|
}
|
|
@@ -3897,10 +3543,8 @@ var transport_strategy_TransportStrategy = (function () {
|
|
|
3897
3543
|
}
|
|
3898
3544
|
}
|
|
3899
3545
|
};
|
|
3900
|
-
}
|
|
3901
|
-
|
|
3902
|
-
}());
|
|
3903
|
-
/* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3904
3548
|
function failAttempt(error, callback) {
|
|
3905
3549
|
util.defer(function () {
|
|
3906
3550
|
callback(error);
|
|
@@ -3917,7 +3561,7 @@ function failAttempt(error, callback) {
|
|
|
3917
3561
|
|
|
3918
3562
|
|
|
3919
3563
|
|
|
3920
|
-
|
|
3564
|
+
const { Transports: strategy_builder_Transports } = worker_runtime;
|
|
3921
3565
|
var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
|
|
3922
3566
|
var transportClass = strategy_builder_Transports[type];
|
|
3923
3567
|
if (!transportClass) {
|
|
@@ -3930,7 +3574,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
|
|
|
3930
3574
|
var transport;
|
|
3931
3575
|
if (enabled) {
|
|
3932
3576
|
options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
|
|
3933
|
-
transport = new
|
|
3577
|
+
transport = new transport_strategy_TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
|
|
3934
3578
|
}
|
|
3935
3579
|
else {
|
|
3936
3580
|
transport = strategy_builder_UnsupportedStrategy;
|
|
@@ -3978,7 +3622,7 @@ var AuthRequestType;
|
|
|
3978
3622
|
// CONCATENATED MODULE: ./src/core/auth/user_authenticator.ts
|
|
3979
3623
|
|
|
3980
3624
|
|
|
3981
|
-
|
|
3625
|
+
const composeChannelQuery = (params, authOptions) => {
|
|
3982
3626
|
var query = 'socket_id=' + encodeURIComponent(params.socketId);
|
|
3983
3627
|
for (var key in authOptions.params) {
|
|
3984
3628
|
query +=
|
|
@@ -3988,7 +3632,7 @@ var composeChannelQuery = function (params, authOptions) {
|
|
|
3988
3632
|
encodeURIComponent(authOptions.params[key]);
|
|
3989
3633
|
}
|
|
3990
3634
|
if (authOptions.paramsProvider != null) {
|
|
3991
|
-
|
|
3635
|
+
let dynamicParams = authOptions.paramsProvider();
|
|
3992
3636
|
for (var key in dynamicParams) {
|
|
3993
3637
|
query +=
|
|
3994
3638
|
'&' +
|
|
@@ -3999,12 +3643,12 @@ var composeChannelQuery = function (params, authOptions) {
|
|
|
3999
3643
|
}
|
|
4000
3644
|
return query;
|
|
4001
3645
|
};
|
|
4002
|
-
|
|
3646
|
+
const UserAuthenticator = (authOptions) => {
|
|
4003
3647
|
if (typeof worker_runtime.getAuthorizers()[authOptions.transport] === 'undefined') {
|
|
4004
|
-
throw
|
|
3648
|
+
throw `'${authOptions.transport}' is not a recognized auth transport`;
|
|
4005
3649
|
}
|
|
4006
|
-
return
|
|
4007
|
-
|
|
3650
|
+
return (params, callback) => {
|
|
3651
|
+
const query = composeChannelQuery(params, authOptions);
|
|
4008
3652
|
worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
|
|
4009
3653
|
};
|
|
4010
3654
|
};
|
|
@@ -4013,7 +3657,7 @@ var UserAuthenticator = function (authOptions) {
|
|
|
4013
3657
|
// CONCATENATED MODULE: ./src/core/auth/channel_authorizer.ts
|
|
4014
3658
|
|
|
4015
3659
|
|
|
4016
|
-
|
|
3660
|
+
const channel_authorizer_composeChannelQuery = (params, authOptions) => {
|
|
4017
3661
|
var query = 'socket_id=' + encodeURIComponent(params.socketId);
|
|
4018
3662
|
query += '&channel_name=' + encodeURIComponent(params.channelName);
|
|
4019
3663
|
for (var key in authOptions.params) {
|
|
@@ -4024,7 +3668,7 @@ var channel_authorizer_composeChannelQuery = function (params, authOptions) {
|
|
|
4024
3668
|
encodeURIComponent(authOptions.params[key]);
|
|
4025
3669
|
}
|
|
4026
3670
|
if (authOptions.paramsProvider != null) {
|
|
4027
|
-
|
|
3671
|
+
let dynamicParams = authOptions.paramsProvider();
|
|
4028
3672
|
for (var key in dynamicParams) {
|
|
4029
3673
|
query +=
|
|
4030
3674
|
'&' +
|
|
@@ -4035,20 +3679,20 @@ var channel_authorizer_composeChannelQuery = function (params, authOptions) {
|
|
|
4035
3679
|
}
|
|
4036
3680
|
return query;
|
|
4037
3681
|
};
|
|
4038
|
-
|
|
3682
|
+
const ChannelAuthorizer = (authOptions) => {
|
|
4039
3683
|
if (typeof worker_runtime.getAuthorizers()[authOptions.transport] === 'undefined') {
|
|
4040
|
-
throw
|
|
3684
|
+
throw `'${authOptions.transport}' is not a recognized auth transport`;
|
|
4041
3685
|
}
|
|
4042
|
-
return
|
|
4043
|
-
|
|
3686
|
+
return (params, callback) => {
|
|
3687
|
+
const query = channel_authorizer_composeChannelQuery(params, authOptions);
|
|
4044
3688
|
worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
|
|
4045
3689
|
};
|
|
4046
3690
|
};
|
|
4047
3691
|
/* harmony default export */ var channel_authorizer = (ChannelAuthorizer);
|
|
4048
3692
|
|
|
4049
3693
|
// CONCATENATED MODULE: ./src/core/auth/deprecated_channel_authorizer.ts
|
|
4050
|
-
|
|
4051
|
-
|
|
3694
|
+
const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
|
|
3695
|
+
const deprecatedAuthorizerOptions = {
|
|
4052
3696
|
authTransport: authOptions.transport,
|
|
4053
3697
|
authEndpoint: authOptions.endpoint,
|
|
4054
3698
|
auth: {
|
|
@@ -4056,32 +3700,21 @@ var ChannelAuthorizerProxy = function (pusher, authOptions, channelAuthorizerGen
|
|
|
4056
3700
|
headers: authOptions.headers
|
|
4057
3701
|
}
|
|
4058
3702
|
};
|
|
4059
|
-
return
|
|
4060
|
-
|
|
4061
|
-
|
|
3703
|
+
return (params, callback) => {
|
|
3704
|
+
const channel = pusher.channel(params.channelName);
|
|
3705
|
+
const channelAuthorizer = channelAuthorizerGenerator(channel, deprecatedAuthorizerOptions);
|
|
4062
3706
|
channelAuthorizer.authorize(params.socketId, callback);
|
|
4063
3707
|
};
|
|
4064
3708
|
};
|
|
4065
3709
|
|
|
4066
3710
|
// CONCATENATED MODULE: ./src/core/config.ts
|
|
4067
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
4068
|
-
__assign = Object.assign || function(t) {
|
|
4069
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4070
|
-
s = arguments[i];
|
|
4071
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
4072
|
-
t[p] = s[p];
|
|
4073
|
-
}
|
|
4074
|
-
return t;
|
|
4075
|
-
};
|
|
4076
|
-
return __assign.apply(this, arguments);
|
|
4077
|
-
};
|
|
4078
3711
|
|
|
4079
3712
|
|
|
4080
3713
|
|
|
4081
3714
|
|
|
4082
3715
|
|
|
4083
3716
|
function getConfig(opts, pusher) {
|
|
4084
|
-
|
|
3717
|
+
let config = {
|
|
4085
3718
|
activityTimeout: opts.activityTimeout || defaults.activityTimeout,
|
|
4086
3719
|
cluster: opts.cluster,
|
|
4087
3720
|
httpPath: opts.httpPath || defaults.httpPath,
|
|
@@ -4118,7 +3751,7 @@ function getHttpHost(opts) {
|
|
|
4118
3751
|
return opts.httpHost;
|
|
4119
3752
|
}
|
|
4120
3753
|
if (opts.cluster) {
|
|
4121
|
-
return
|
|
3754
|
+
return `sockjs-${opts.cluster}.pusher.com`;
|
|
4122
3755
|
}
|
|
4123
3756
|
return defaults.httpHost;
|
|
4124
3757
|
}
|
|
@@ -4129,7 +3762,7 @@ function getWebsocketHost(opts) {
|
|
|
4129
3762
|
return getWebsocketHostFromCluster(opts.cluster);
|
|
4130
3763
|
}
|
|
4131
3764
|
function getWebsocketHostFromCluster(cluster) {
|
|
4132
|
-
return
|
|
3765
|
+
return `ws-${cluster}.pusher.com`;
|
|
4133
3766
|
}
|
|
4134
3767
|
function shouldUseTLS(opts) {
|
|
4135
3768
|
if (worker_runtime.getProtocol() === 'https:') {
|
|
@@ -4150,7 +3783,7 @@ function getEnableStatsConfig(opts) {
|
|
|
4150
3783
|
return false;
|
|
4151
3784
|
}
|
|
4152
3785
|
function buildUserAuthenticator(opts) {
|
|
4153
|
-
|
|
3786
|
+
const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
4154
3787
|
if ('customHandler' in userAuthentication &&
|
|
4155
3788
|
userAuthentication['customHandler'] != null) {
|
|
4156
3789
|
return userAuthentication['customHandler'];
|
|
@@ -4158,9 +3791,9 @@ function buildUserAuthenticator(opts) {
|
|
|
4158
3791
|
return user_authenticator(userAuthentication);
|
|
4159
3792
|
}
|
|
4160
3793
|
function buildChannelAuth(opts, pusher) {
|
|
4161
|
-
|
|
3794
|
+
let channelAuthorization;
|
|
4162
3795
|
if ('channelAuthorization' in opts) {
|
|
4163
|
-
channelAuthorization =
|
|
3796
|
+
channelAuthorization = Object.assign(Object.assign({}, defaults.channelAuthorization), opts.channelAuthorization);
|
|
4164
3797
|
}
|
|
4165
3798
|
else {
|
|
4166
3799
|
channelAuthorization = {
|
|
@@ -4179,7 +3812,7 @@ function buildChannelAuth(opts, pusher) {
|
|
|
4179
3812
|
return channelAuthorization;
|
|
4180
3813
|
}
|
|
4181
3814
|
function buildChannelAuthorizer(opts, pusher) {
|
|
4182
|
-
|
|
3815
|
+
const channelAuthorization = buildChannelAuth(opts, pusher);
|
|
4183
3816
|
if ('customHandler' in channelAuthorization &&
|
|
4184
3817
|
channelAuthorization['customHandler'] != null) {
|
|
4185
3818
|
return channelAuthorization['customHandler'];
|
|
@@ -4188,134 +3821,99 @@ function buildChannelAuthorizer(opts, pusher) {
|
|
|
4188
3821
|
}
|
|
4189
3822
|
|
|
4190
3823
|
// CONCATENATED MODULE: ./src/core/watchlist.ts
|
|
4191
|
-
var watchlist_extends = (undefined && undefined.__extends) || (function () {
|
|
4192
|
-
var extendStatics = function (d, b) {
|
|
4193
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4194
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
4195
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
4196
|
-
return extendStatics(d, b);
|
|
4197
|
-
};
|
|
4198
|
-
return function (d, b) {
|
|
4199
|
-
extendStatics(d, b);
|
|
4200
|
-
function __() { this.constructor = d; }
|
|
4201
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
4202
|
-
};
|
|
4203
|
-
})();
|
|
4204
3824
|
|
|
4205
3825
|
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
logger.debug("No callbacks on watchlist events for " + eventName);
|
|
4211
|
-
}) || this;
|
|
4212
|
-
_this.pusher = pusher;
|
|
4213
|
-
_this.bindWatchlistInternalEvent();
|
|
4214
|
-
return _this;
|
|
4215
|
-
}
|
|
4216
|
-
WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
|
|
4217
|
-
var _this = this;
|
|
4218
|
-
pusherEvent.data.events.forEach(function (watchlistEvent) {
|
|
4219
|
-
_this.emit(watchlistEvent.name, watchlistEvent);
|
|
3826
|
+
class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
|
|
3827
|
+
constructor(pusher) {
|
|
3828
|
+
super(function (eventName, data) {
|
|
3829
|
+
logger.debug(`No callbacks on watchlist events for ${eventName}`);
|
|
4220
3830
|
});
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
3831
|
+
this.pusher = pusher;
|
|
3832
|
+
this.bindWatchlistInternalEvent();
|
|
3833
|
+
}
|
|
3834
|
+
handleEvent(pusherEvent) {
|
|
3835
|
+
pusherEvent.data.events.forEach(watchlistEvent => {
|
|
3836
|
+
this.emit(watchlistEvent.name, watchlistEvent);
|
|
3837
|
+
});
|
|
3838
|
+
}
|
|
3839
|
+
bindWatchlistInternalEvent() {
|
|
3840
|
+
this.pusher.connection.bind('message', pusherEvent => {
|
|
4225
3841
|
var eventName = pusherEvent.event;
|
|
4226
3842
|
if (eventName === 'pusher_internal:watchlist_events') {
|
|
4227
|
-
|
|
3843
|
+
this.handleEvent(pusherEvent);
|
|
4228
3844
|
}
|
|
4229
3845
|
});
|
|
4230
|
-
}
|
|
4231
|
-
|
|
4232
|
-
}(dispatcher));
|
|
4233
|
-
/* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
4234
3848
|
|
|
4235
3849
|
// CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
|
|
4236
3850
|
function flatPromise() {
|
|
4237
|
-
|
|
4238
|
-
|
|
3851
|
+
let resolve, reject;
|
|
3852
|
+
const promise = new Promise((res, rej) => {
|
|
4239
3853
|
resolve = res;
|
|
4240
3854
|
reject = rej;
|
|
4241
3855
|
});
|
|
4242
|
-
return { promise
|
|
3856
|
+
return { promise, resolve, reject };
|
|
4243
3857
|
}
|
|
4244
3858
|
/* harmony default export */ var flat_promise = (flatPromise);
|
|
4245
3859
|
|
|
4246
3860
|
// CONCATENATED MODULE: ./src/core/user.ts
|
|
4247
|
-
var user_extends = (undefined && undefined.__extends) || (function () {
|
|
4248
|
-
var extendStatics = function (d, b) {
|
|
4249
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4250
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
4251
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
4252
|
-
return extendStatics(d, b);
|
|
4253
|
-
};
|
|
4254
|
-
return function (d, b) {
|
|
4255
|
-
extendStatics(d, b);
|
|
4256
|
-
function __() { this.constructor = d; }
|
|
4257
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
4258
|
-
};
|
|
4259
|
-
})();
|
|
4260
3861
|
|
|
4261
3862
|
|
|
4262
3863
|
|
|
4263
3864
|
|
|
4264
3865
|
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
var _this = _super.call(this, function (eventName, data) {
|
|
3866
|
+
class user_UserFacade extends dispatcher_Dispatcher {
|
|
3867
|
+
constructor(pusher) {
|
|
3868
|
+
super(function (eventName, data) {
|
|
4269
3869
|
logger.debug('No callbacks on user for ' + eventName);
|
|
4270
|
-
})
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
3870
|
+
});
|
|
3871
|
+
this.signin_requested = false;
|
|
3872
|
+
this.user_data = null;
|
|
3873
|
+
this.serverToUserChannel = null;
|
|
3874
|
+
this.signinDonePromise = null;
|
|
3875
|
+
this._signinDoneResolve = null;
|
|
3876
|
+
this._onAuthorize = (err, authData) => {
|
|
4277
3877
|
if (err) {
|
|
4278
|
-
logger.warn(
|
|
4279
|
-
|
|
3878
|
+
logger.warn(`Error during signin: ${err}`);
|
|
3879
|
+
this._cleanup();
|
|
4280
3880
|
return;
|
|
4281
3881
|
}
|
|
4282
|
-
|
|
3882
|
+
this.pusher.send_event('pusher:signin', {
|
|
4283
3883
|
auth: authData.auth,
|
|
4284
3884
|
user_data: authData.user_data
|
|
4285
3885
|
});
|
|
4286
3886
|
};
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
var previous = _a.previous, current = _a.current;
|
|
3887
|
+
this.pusher = pusher;
|
|
3888
|
+
this.pusher.connection.bind('state_change', ({ previous, current }) => {
|
|
4290
3889
|
if (previous !== 'connected' && current === 'connected') {
|
|
4291
|
-
|
|
3890
|
+
this._signin();
|
|
4292
3891
|
}
|
|
4293
3892
|
if (previous === 'connected' && current !== 'connected') {
|
|
4294
|
-
|
|
4295
|
-
|
|
3893
|
+
this._cleanup();
|
|
3894
|
+
this._newSigninPromiseIfNeeded();
|
|
4296
3895
|
}
|
|
4297
3896
|
});
|
|
4298
|
-
|
|
4299
|
-
|
|
3897
|
+
this.watchlist = new watchlist_WatchlistFacade(pusher);
|
|
3898
|
+
this.pusher.connection.bind('message', event => {
|
|
4300
3899
|
var eventName = event.event;
|
|
4301
3900
|
if (eventName === 'pusher:signin_success') {
|
|
4302
|
-
|
|
3901
|
+
this._onSigninSuccess(event.data);
|
|
4303
3902
|
}
|
|
4304
|
-
if (
|
|
4305
|
-
|
|
4306
|
-
|
|
3903
|
+
if (this.serverToUserChannel &&
|
|
3904
|
+
this.serverToUserChannel.name === event.channel) {
|
|
3905
|
+
this.serverToUserChannel.handleEvent(event);
|
|
4307
3906
|
}
|
|
4308
3907
|
});
|
|
4309
|
-
return _this;
|
|
4310
3908
|
}
|
|
4311
|
-
|
|
3909
|
+
signin() {
|
|
4312
3910
|
if (this.signin_requested) {
|
|
4313
3911
|
return;
|
|
4314
3912
|
}
|
|
4315
3913
|
this.signin_requested = true;
|
|
4316
3914
|
this._signin();
|
|
4317
|
-
}
|
|
4318
|
-
|
|
3915
|
+
}
|
|
3916
|
+
_signin() {
|
|
4319
3917
|
if (!this.signin_requested) {
|
|
4320
3918
|
return;
|
|
4321
3919
|
}
|
|
@@ -4326,46 +3924,45 @@ var user_UserFacade = (function (_super) {
|
|
|
4326
3924
|
this.pusher.config.userAuthenticator({
|
|
4327
3925
|
socketId: this.pusher.connection.socket_id
|
|
4328
3926
|
}, this._onAuthorize);
|
|
4329
|
-
}
|
|
4330
|
-
|
|
3927
|
+
}
|
|
3928
|
+
_onSigninSuccess(data) {
|
|
4331
3929
|
try {
|
|
4332
3930
|
this.user_data = JSON.parse(data.user_data);
|
|
4333
3931
|
}
|
|
4334
3932
|
catch (e) {
|
|
4335
|
-
logger.error(
|
|
3933
|
+
logger.error(`Failed parsing user data after signin: ${data.user_data}`);
|
|
4336
3934
|
this._cleanup();
|
|
4337
3935
|
return;
|
|
4338
3936
|
}
|
|
4339
3937
|
if (typeof this.user_data.id !== 'string' || this.user_data.id === '') {
|
|
4340
|
-
logger.error(
|
|
3938
|
+
logger.error(`user_data doesn't contain an id. user_data: ${this.user_data}`);
|
|
4341
3939
|
this._cleanup();
|
|
4342
3940
|
return;
|
|
4343
3941
|
}
|
|
4344
3942
|
this._signinDoneResolve();
|
|
4345
3943
|
this._subscribeChannels();
|
|
4346
|
-
}
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
var ensure_subscribed = function (channel) {
|
|
3944
|
+
}
|
|
3945
|
+
_subscribeChannels() {
|
|
3946
|
+
const ensure_subscribed = channel => {
|
|
4350
3947
|
if (channel.subscriptionPending && channel.subscriptionCancelled) {
|
|
4351
3948
|
channel.reinstateSubscription();
|
|
4352
3949
|
}
|
|
4353
3950
|
else if (!channel.subscriptionPending &&
|
|
4354
|
-
|
|
3951
|
+
this.pusher.connection.state === 'connected') {
|
|
4355
3952
|
channel.subscribe();
|
|
4356
3953
|
}
|
|
4357
3954
|
};
|
|
4358
|
-
this.serverToUserChannel = new
|
|
4359
|
-
this.serverToUserChannel.bind_global(
|
|
3955
|
+
this.serverToUserChannel = new channel_Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
|
|
3956
|
+
this.serverToUserChannel.bind_global((eventName, data) => {
|
|
4360
3957
|
if (eventName.indexOf('pusher_internal:') === 0 ||
|
|
4361
3958
|
eventName.indexOf('pusher:') === 0) {
|
|
4362
3959
|
return;
|
|
4363
3960
|
}
|
|
4364
|
-
|
|
3961
|
+
this.emit(eventName, data);
|
|
4365
3962
|
});
|
|
4366
3963
|
ensure_subscribed(this.serverToUserChannel);
|
|
4367
|
-
}
|
|
4368
|
-
|
|
3964
|
+
}
|
|
3965
|
+
_cleanup() {
|
|
4369
3966
|
this.user_data = null;
|
|
4370
3967
|
if (this.serverToUserChannel) {
|
|
4371
3968
|
this.serverToUserChannel.unbind_all();
|
|
@@ -4375,26 +3972,24 @@ var user_UserFacade = (function (_super) {
|
|
|
4375
3972
|
if (this.signin_requested) {
|
|
4376
3973
|
this._signinDoneResolve();
|
|
4377
3974
|
}
|
|
4378
|
-
}
|
|
4379
|
-
|
|
3975
|
+
}
|
|
3976
|
+
_newSigninPromiseIfNeeded() {
|
|
4380
3977
|
if (!this.signin_requested) {
|
|
4381
3978
|
return;
|
|
4382
3979
|
}
|
|
4383
3980
|
if (this.signinDonePromise && !this.signinDonePromise.done) {
|
|
4384
3981
|
return;
|
|
4385
3982
|
}
|
|
4386
|
-
|
|
3983
|
+
const { promise, resolve, reject: _ } = flat_promise();
|
|
4387
3984
|
promise.done = false;
|
|
4388
|
-
|
|
3985
|
+
const setDone = () => {
|
|
4389
3986
|
promise.done = true;
|
|
4390
3987
|
};
|
|
4391
|
-
promise.then(setDone)
|
|
3988
|
+
promise.then(setDone).catch(setDone);
|
|
4392
3989
|
this.signinDonePromise = promise;
|
|
4393
3990
|
this._signinDoneResolve = resolve;
|
|
4394
|
-
}
|
|
4395
|
-
|
|
4396
|
-
}(dispatcher));
|
|
4397
|
-
/* harmony default export */ var user = (user_UserFacade);
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
4398
3993
|
|
|
4399
3994
|
// CONCATENATED MODULE: ./src/core/pusher.ts
|
|
4400
3995
|
|
|
@@ -4410,19 +4005,29 @@ var user_UserFacade = (function (_super) {
|
|
|
4410
4005
|
|
|
4411
4006
|
|
|
4412
4007
|
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4008
|
+
class pusher_Pusher {
|
|
4009
|
+
static ready() {
|
|
4010
|
+
pusher_Pusher.isReady = true;
|
|
4011
|
+
for (var i = 0, l = pusher_Pusher.instances.length; i < l; i++) {
|
|
4012
|
+
pusher_Pusher.instances[i].connect();
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
static getClientFeatures() {
|
|
4016
|
+
return keys(filterObject({ ws: worker_runtime.Transports.ws }, function (t) {
|
|
4017
|
+
return t.isSupported({});
|
|
4018
|
+
}));
|
|
4019
|
+
}
|
|
4020
|
+
constructor(app_key, options) {
|
|
4416
4021
|
checkAppKey(app_key);
|
|
4417
4022
|
validateOptions(options);
|
|
4418
4023
|
this.key = app_key;
|
|
4419
4024
|
this.config = getConfig(options, this);
|
|
4420
4025
|
this.channels = factory.createChannels();
|
|
4421
|
-
this.global_emitter = new
|
|
4026
|
+
this.global_emitter = new dispatcher_Dispatcher();
|
|
4422
4027
|
this.sessionID = worker_runtime.randomInt(1000000000);
|
|
4423
|
-
this.timeline = new
|
|
4028
|
+
this.timeline = new timeline_Timeline(this.key, this.sessionID, {
|
|
4424
4029
|
cluster: this.config.cluster,
|
|
4425
|
-
features:
|
|
4030
|
+
features: pusher_Pusher.getClientFeatures(),
|
|
4426
4031
|
params: this.config.timelineParams || {},
|
|
4427
4032
|
limit: 50,
|
|
4428
4033
|
level: timeline_level.INFO,
|
|
@@ -4434,8 +4039,8 @@ var pusher_Pusher = (function () {
|
|
|
4434
4039
|
path: '/timeline/v2/' + worker_runtime.TimelineTransport.name
|
|
4435
4040
|
});
|
|
4436
4041
|
}
|
|
4437
|
-
var getStrategy =
|
|
4438
|
-
return worker_runtime.getDefaultStrategy(
|
|
4042
|
+
var getStrategy = (options) => {
|
|
4043
|
+
return worker_runtime.getDefaultStrategy(this.config, options, strategy_builder_defineTransport);
|
|
4439
4044
|
};
|
|
4440
4045
|
this.connection = factory.createConnectionManager(this.key, {
|
|
4441
4046
|
getStrategy: getStrategy,
|
|
@@ -4445,106 +4050,95 @@ var pusher_Pusher = (function () {
|
|
|
4445
4050
|
unavailableTimeout: this.config.unavailableTimeout,
|
|
4446
4051
|
useTLS: Boolean(this.config.useTLS)
|
|
4447
4052
|
});
|
|
4448
|
-
this.connection.bind('connected',
|
|
4449
|
-
|
|
4450
|
-
if (
|
|
4451
|
-
|
|
4053
|
+
this.connection.bind('connected', () => {
|
|
4054
|
+
this.subscribeAll();
|
|
4055
|
+
if (this.timelineSender) {
|
|
4056
|
+
this.timelineSender.send(this.connection.isUsingTLS());
|
|
4452
4057
|
}
|
|
4453
4058
|
});
|
|
4454
|
-
this.connection.bind('message',
|
|
4059
|
+
this.connection.bind('message', event => {
|
|
4455
4060
|
var eventName = event.event;
|
|
4456
4061
|
var internal = eventName.indexOf('pusher_internal:') === 0;
|
|
4457
4062
|
if (event.channel) {
|
|
4458
|
-
var channel =
|
|
4063
|
+
var channel = this.channel(event.channel);
|
|
4459
4064
|
if (channel) {
|
|
4460
4065
|
channel.handleEvent(event);
|
|
4461
4066
|
}
|
|
4462
4067
|
}
|
|
4463
4068
|
if (!internal) {
|
|
4464
|
-
|
|
4069
|
+
this.global_emitter.emit(event.event, event.data);
|
|
4465
4070
|
}
|
|
4466
4071
|
});
|
|
4467
|
-
this.connection.bind('connecting',
|
|
4468
|
-
|
|
4072
|
+
this.connection.bind('connecting', () => {
|
|
4073
|
+
this.channels.disconnect();
|
|
4469
4074
|
});
|
|
4470
|
-
this.connection.bind('disconnected',
|
|
4471
|
-
|
|
4075
|
+
this.connection.bind('disconnected', () => {
|
|
4076
|
+
this.channels.disconnect();
|
|
4472
4077
|
});
|
|
4473
|
-
this.connection.bind('error',
|
|
4078
|
+
this.connection.bind('error', err => {
|
|
4474
4079
|
logger.warn(err);
|
|
4475
4080
|
});
|
|
4476
|
-
|
|
4477
|
-
this.timeline.info({ instances:
|
|
4478
|
-
this.user = new
|
|
4479
|
-
if (
|
|
4081
|
+
pusher_Pusher.instances.push(this);
|
|
4082
|
+
this.timeline.info({ instances: pusher_Pusher.instances.length });
|
|
4083
|
+
this.user = new user_UserFacade(this);
|
|
4084
|
+
if (pusher_Pusher.isReady) {
|
|
4480
4085
|
this.connect();
|
|
4481
4086
|
}
|
|
4482
4087
|
}
|
|
4483
|
-
|
|
4484
|
-
Pusher.isReady = true;
|
|
4485
|
-
for (var i = 0, l = Pusher.instances.length; i < l; i++) {
|
|
4486
|
-
Pusher.instances[i].connect();
|
|
4487
|
-
}
|
|
4488
|
-
};
|
|
4489
|
-
Pusher.getClientFeatures = function () {
|
|
4490
|
-
return keys(filterObject({ ws: worker_runtime.Transports.ws }, function (t) {
|
|
4491
|
-
return t.isSupported({});
|
|
4492
|
-
}));
|
|
4493
|
-
};
|
|
4494
|
-
Pusher.prototype.channel = function (name) {
|
|
4088
|
+
channel(name) {
|
|
4495
4089
|
return this.channels.find(name);
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4090
|
+
}
|
|
4091
|
+
allChannels() {
|
|
4498
4092
|
return this.channels.all();
|
|
4499
|
-
}
|
|
4500
|
-
|
|
4093
|
+
}
|
|
4094
|
+
connect() {
|
|
4501
4095
|
this.connection.connect();
|
|
4502
4096
|
if (this.timelineSender) {
|
|
4503
4097
|
if (!this.timelineSenderTimer) {
|
|
4504
4098
|
var usingTLS = this.connection.isUsingTLS();
|
|
4505
4099
|
var timelineSender = this.timelineSender;
|
|
4506
|
-
this.timelineSenderTimer = new
|
|
4100
|
+
this.timelineSenderTimer = new timers_PeriodicTimer(60000, function () {
|
|
4507
4101
|
timelineSender.send(usingTLS);
|
|
4508
4102
|
});
|
|
4509
4103
|
}
|
|
4510
4104
|
}
|
|
4511
|
-
}
|
|
4512
|
-
|
|
4105
|
+
}
|
|
4106
|
+
disconnect() {
|
|
4513
4107
|
this.connection.disconnect();
|
|
4514
4108
|
if (this.timelineSenderTimer) {
|
|
4515
4109
|
this.timelineSenderTimer.ensureAborted();
|
|
4516
4110
|
this.timelineSenderTimer = null;
|
|
4517
4111
|
}
|
|
4518
|
-
}
|
|
4519
|
-
|
|
4112
|
+
}
|
|
4113
|
+
bind(event_name, callback, context) {
|
|
4520
4114
|
this.global_emitter.bind(event_name, callback, context);
|
|
4521
4115
|
return this;
|
|
4522
|
-
}
|
|
4523
|
-
|
|
4116
|
+
}
|
|
4117
|
+
unbind(event_name, callback, context) {
|
|
4524
4118
|
this.global_emitter.unbind(event_name, callback, context);
|
|
4525
4119
|
return this;
|
|
4526
|
-
}
|
|
4527
|
-
|
|
4120
|
+
}
|
|
4121
|
+
bind_global(callback) {
|
|
4528
4122
|
this.global_emitter.bind_global(callback);
|
|
4529
4123
|
return this;
|
|
4530
|
-
}
|
|
4531
|
-
|
|
4124
|
+
}
|
|
4125
|
+
unbind_global(callback) {
|
|
4532
4126
|
this.global_emitter.unbind_global(callback);
|
|
4533
4127
|
return this;
|
|
4534
|
-
}
|
|
4535
|
-
|
|
4128
|
+
}
|
|
4129
|
+
unbind_all(callback) {
|
|
4536
4130
|
this.global_emitter.unbind_all();
|
|
4537
4131
|
return this;
|
|
4538
|
-
}
|
|
4539
|
-
|
|
4132
|
+
}
|
|
4133
|
+
subscribeAll() {
|
|
4540
4134
|
var channelName;
|
|
4541
4135
|
for (channelName in this.channels.channels) {
|
|
4542
4136
|
if (this.channels.channels.hasOwnProperty(channelName)) {
|
|
4543
4137
|
this.subscribe(channelName);
|
|
4544
4138
|
}
|
|
4545
4139
|
}
|
|
4546
|
-
}
|
|
4547
|
-
|
|
4140
|
+
}
|
|
4141
|
+
subscribe(channel_name) {
|
|
4548
4142
|
var channel = this.channels.add(channel_name, this);
|
|
4549
4143
|
if (channel.subscriptionPending && channel.subscriptionCancelled) {
|
|
4550
4144
|
channel.reinstateSubscription();
|
|
@@ -4554,8 +4148,8 @@ var pusher_Pusher = (function () {
|
|
|
4554
4148
|
channel.subscribe();
|
|
4555
4149
|
}
|
|
4556
4150
|
return channel;
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4151
|
+
}
|
|
4152
|
+
unsubscribe(channel_name) {
|
|
4559
4153
|
var channel = this.channels.find(channel_name);
|
|
4560
4154
|
if (channel && channel.subscriptionPending) {
|
|
4561
4155
|
channel.cancelSubscription();
|
|
@@ -4566,25 +4160,24 @@ var pusher_Pusher = (function () {
|
|
|
4566
4160
|
channel.unsubscribe();
|
|
4567
4161
|
}
|
|
4568
4162
|
}
|
|
4569
|
-
}
|
|
4570
|
-
|
|
4163
|
+
}
|
|
4164
|
+
send_event(event_name, data, channel) {
|
|
4571
4165
|
return this.connection.send_event(event_name, data, channel);
|
|
4572
|
-
}
|
|
4573
|
-
|
|
4166
|
+
}
|
|
4167
|
+
shouldUseTLS() {
|
|
4574
4168
|
return this.config.useTLS;
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4169
|
+
}
|
|
4170
|
+
signin() {
|
|
4577
4171
|
this.user.signin();
|
|
4578
|
-
}
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
}());
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
pusher_Pusher.instances = [];
|
|
4175
|
+
pusher_Pusher.isReady = false;
|
|
4176
|
+
pusher_Pusher.logToConsole = false;
|
|
4177
|
+
pusher_Pusher.Runtime = worker_runtime;
|
|
4178
|
+
pusher_Pusher.ScriptReceivers = worker_runtime.ScriptReceivers;
|
|
4179
|
+
pusher_Pusher.DependenciesReceivers = worker_runtime.DependenciesReceivers;
|
|
4180
|
+
pusher_Pusher.auth_callbacks = worker_runtime.auth_callbacks;
|
|
4588
4181
|
/* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
|
|
4589
4182
|
function checkAppKey(key) {
|
|
4590
4183
|
if (key === null || key === undefined) {
|