pusher-fake 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e7459cf521ab87d3bd4c57ce0c11a2db1976ba0
4
- data.tar.gz: '0543389734f7086e9c639c03c46b8b46e7907744'
3
+ metadata.gz: 6f3eacabe00d510d5ad31f3796c821a0b34de364
4
+ data.tar.gz: c144fc964da7577d3244f08f3c36f648302c8e4f
5
5
  SHA512:
6
- metadata.gz: ee723d426db471698d5b0f897a2d0808cbbee1d0cab916c72f3595eaa09ace15c78683ab15217c429f59efa50dec5361fb1b9545b77e697a8a5840f99502a820
7
- data.tar.gz: 935b22b74f151af851c63b1f9e030a36748c8ca3a85449be1a5fcd026aab5d82f90846e45adf9c757f99a993f915a570b3c1683977710e08e0080984de86f461
6
+ metadata.gz: 4dda368dd7c7c488399ce316e7eac7c8e90e0da213c8b96009aef2fc01e997ebfebddd8fd7fe8acae6413953427b31a3d0ee5106e5f0f491f4f4031dc80f7e81
7
+ data.tar.gz: 535020b68c34f77dac67828bef623d3ca76f9bb72139bd4290cc644d31e6e380b2248074c502c8f89c46b737e1df74b3b4cc6d29ba24c2667f8366d144c81aa6
@@ -1,4 +1,4 @@
1
- # rubocop:disable Style/FileName
1
+ # rubocop:disable Naming/FileName
2
2
 
3
3
  require "em-http-request"
4
4
  require "em-websocket"
@@ -9,7 +9,7 @@ require "thin"
9
9
  # A Pusher fake.
10
10
  module PusherFake
11
11
  # The current version string.
12
- VERSION = "1.8.0".freeze
12
+ VERSION = "1.9.0".freeze
13
13
 
14
14
  autoload :Channel, "pusher-fake/channel"
15
15
  autoload :Configuration, "pusher-fake/configuration"
@@ -51,8 +51,9 @@ module PusherFake
51
51
  # @param [Hash] options Custom options for Pusher client.
52
52
  def to_options(options = {})
53
53
  options.merge(
54
- wsHost: socket_options[:host],
55
- wsPort: socket_options[:port]
54
+ wsHost: socket_options[:host],
55
+ wsPort: socket_options[:port],
56
+ cluster: "us-east-1"
56
57
  )
57
58
  end
58
59
 
@@ -28,7 +28,7 @@ module PusherFake
28
28
  response = response_for(request)
29
29
 
30
30
  Rack::Response.new(MultiJson.dump(response)).finish
31
- rescue => error
31
+ rescue => error # rubocop:disable Lint/RescueWithoutErrorClass
32
32
  Rack::Response.new(error.message, 400).finish
33
33
  end
34
34
 
@@ -1,10 +1,15 @@
1
1
  %w(app_id key secret).each do |setting|
2
2
  next unless Pusher.public_send(setting).nil?
3
3
 
4
- warn("Warning: Pusher.#{setting} is not set." \
4
+ warn("Warning: Pusher.#{setting} is not set. " \
5
5
  "Should be set before including PusherFake")
6
6
  end
7
7
 
8
+ unless defined?(PusherFake)
9
+ warn("Warning: PusherFake is not defined. " \
10
+ "Should be required before requiring a support file.")
11
+ end
12
+
8
13
  # Use the same API key and secret as the live version.
9
14
  PusherFake.configure do |configuration|
10
15
  configuration.app_id = Pusher.app_id
@@ -4,7 +4,9 @@ feature "Client subscribing to a channel" do
4
4
  before do
5
5
  visit "/"
6
6
 
7
+ # rubocop:disable RSpec/ExpectInHook
7
8
  expect(page).to have_content("Client connected.")
9
+ # rubocop:enable RSpec/ExpectInHook
8
10
  end
9
11
 
10
12
  scenario "successfully subscribes to a channel" do
@@ -61,6 +61,12 @@ describe PusherFake::Configuration, "#to_options" do
61
61
  expect(options).to include(wsPort: subject.socket_options[:port])
62
62
  end
63
63
 
64
+ it "includes the cluster by default" do
65
+ options = subject.to_options
66
+
67
+ expect(options).to include(cluster: "us-east-1")
68
+ end
69
+
64
70
  it "supports passing custom options" do
65
71
  options = subject.to_options(custom: "option")
66
72
 
@@ -3,8 +3,8 @@ require "tilt/erb"
3
3
 
4
4
  module Sinatra
5
5
  class Application
6
- set :root, proc { File.join(File.dirname(__FILE__), "application") }
7
- set :views, proc { File.join(root, "views") }
6
+ set(:root, proc { File.join(File.dirname(__FILE__), "application") })
7
+ set(:views, proc { File.join(root, "views") })
8
8
 
9
9
  disable :logging
10
10
 
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * Pusher JavaScript Library v3.2.1
3
- * http://pusher.com/
2
+ * Pusher JavaScript Library v4.2.1
3
+ * https://pusher.com/
4
4
  *
5
- * Copyright 2016, Pusher
5
+ * Copyright 2017, Pusher
6
6
  * Released under the MIT licence.
7
7
  */
8
8
 
@@ -60,34 +60,39 @@ return /******/ (function(modules) { // webpackBootstrap
60
60
  /************************************************************************/
61
61
  /******/ ([
62
62
  /* 0 */
63
- /***/ function(module, exports, __webpack_require__) {
63
+ /***/ (function(module, exports, __webpack_require__) {
64
64
 
65
65
  "use strict";
66
66
  var pusher_1 = __webpack_require__(1);
67
67
  module.exports = pusher_1["default"];
68
68
 
69
69
 
70
- /***/ },
70
+ /***/ }),
71
71
  /* 1 */
72
- /***/ function(module, exports, __webpack_require__) {
72
+ /***/ (function(module, exports, __webpack_require__) {
73
73
 
74
74
  "use strict";
75
75
  var runtime_1 = __webpack_require__(2);
76
76
  var Collections = __webpack_require__(9);
77
- var dispatcher_1 = __webpack_require__(23);
78
- var timeline_1 = __webpack_require__(38);
79
- var level_1 = __webpack_require__(39);
80
- var StrategyBuilder = __webpack_require__(40);
77
+ var dispatcher_1 = __webpack_require__(24);
78
+ var timeline_1 = __webpack_require__(39);
79
+ var level_1 = __webpack_require__(40);
80
+ var StrategyBuilder = __webpack_require__(41);
81
81
  var timers_1 = __webpack_require__(12);
82
82
  var defaults_1 = __webpack_require__(5);
83
- var DefaultConfig = __webpack_require__(62);
83
+ var DefaultConfig = __webpack_require__(63);
84
84
  var logger_1 = __webpack_require__(8);
85
- var factory_1 = __webpack_require__(42);
85
+ var factory_1 = __webpack_require__(43);
86
+ var url_store_1 = __webpack_require__(14);
86
87
  var Pusher = (function () {
87
88
  function Pusher(app_key, options) {
88
89
  var _this = this;
89
90
  checkAppKey(app_key);
90
91
  options = options || {};
92
+ if (!options.cluster) {
93
+ var suffix = url_store_1["default"].buildLogSuffix("javascriptQuickStart");
94
+ logger_1["default"].warn("You should always specify a cluster when connecting. " + suffix);
95
+ }
91
96
  this.key = app_key;
92
97
  this.config = Collections.extend(DefaultConfig.getGlobalConfig(), options.cluster ? DefaultConfig.getClusterConfig(options.cluster) : {}, options);
93
98
  this.channels = factory_1["default"].createChannels();
@@ -135,6 +140,9 @@ return /******/ (function(modules) { // webpackBootstrap
135
140
  _this.global_emitter.emit(params.event, params.data);
136
141
  }
137
142
  });
143
+ this.connection.bind('connecting', function () {
144
+ _this.channels.disconnect();
145
+ });
138
146
  this.connection.bind('disconnected', function () {
139
147
  _this.channels.disconnect();
140
148
  });
@@ -186,16 +194,24 @@ return /******/ (function(modules) { // webpackBootstrap
186
194
  this.timelineSenderTimer = null;
187
195
  }
188
196
  };
189
- Pusher.prototype.bind = function (event_name, callback) {
190
- this.global_emitter.bind(event_name, callback);
197
+ Pusher.prototype.bind = function (event_name, callback, context) {
198
+ this.global_emitter.bind(event_name, callback, context);
199
+ return this;
200
+ };
201
+ Pusher.prototype.unbind = function (event_name, callback, context) {
202
+ this.global_emitter.unbind(event_name, callback, context);
191
203
  return this;
192
204
  };
193
- Pusher.prototype.unbind = function (event_name, callback) {
194
- this.global_emitter.unbind(event_name, callback);
205
+ Pusher.prototype.bind_global = function (callback) {
206
+ this.global_emitter.bind_global(callback);
195
207
  return this;
196
208
  };
197
- Pusher.prototype.bind_all = function (callback) {
198
- this.global_emitter.bind_all(callback);
209
+ Pusher.prototype.unbind_global = function (callback) {
210
+ this.global_emitter.unbind_global(callback);
211
+ return this;
212
+ };
213
+ Pusher.prototype.unbind_all = function (callback) {
214
+ this.global_emitter.unbind_all();
199
215
  return this;
200
216
  };
201
217
  Pusher.prototype.subscribeAll = function () {
@@ -208,15 +224,24 @@ return /******/ (function(modules) { // webpackBootstrap
208
224
  };
209
225
  Pusher.prototype.subscribe = function (channel_name) {
210
226
  var channel = this.channels.add(channel_name, this);
211
- if (this.connection.state === "connected") {
227
+ if (channel.subscriptionPending && channel.subscriptionCancelled) {
228
+ channel.reinstateSubscription();
229
+ }
230
+ else if (!channel.subscriptionPending && this.connection.state === "connected") {
212
231
  channel.subscribe();
213
232
  }
214
233
  return channel;
215
234
  };
216
235
  Pusher.prototype.unsubscribe = function (channel_name) {
217
- var channel = this.channels.remove(channel_name);
218
- if (channel && this.connection.state === "connected") {
219
- channel.unsubscribe();
236
+ var channel = this.channels.find(channel_name);
237
+ if (channel && channel.subscriptionPending) {
238
+ channel.cancelSubscription();
239
+ }
240
+ else {
241
+ channel = this.channels.remove(channel_name);
242
+ if (channel && this.connection.state === "connected") {
243
+ channel.unsubscribe();
244
+ }
220
245
  }
221
246
  };
222
247
  Pusher.prototype.send_event = function (event_name, data, channel) {
@@ -249,23 +274,23 @@ return /******/ (function(modules) { // webpackBootstrap
249
274
  runtime_1["default"].setup(Pusher);
250
275
 
251
276
 
252
- /***/ },
277
+ /***/ }),
253
278
  /* 2 */
254
- /***/ function(module, exports, __webpack_require__) {
279
+ /***/ (function(module, exports, __webpack_require__) {
255
280
 
256
281
  "use strict";
257
282
  var dependencies_1 = __webpack_require__(3);
258
283
  var xhr_auth_1 = __webpack_require__(7);
259
- var jsonp_auth_1 = __webpack_require__(14);
260
- var script_request_1 = __webpack_require__(15);
261
- var jsonp_request_1 = __webpack_require__(16);
284
+ var jsonp_auth_1 = __webpack_require__(15);
285
+ var script_request_1 = __webpack_require__(16);
286
+ var jsonp_request_1 = __webpack_require__(17);
262
287
  var script_receiver_factory_1 = __webpack_require__(4);
263
- var jsonp_timeline_1 = __webpack_require__(17);
264
- var transports_1 = __webpack_require__(18);
265
- var net_info_1 = __webpack_require__(25);
266
- var default_strategy_1 = __webpack_require__(26);
267
- var transport_connection_initializer_1 = __webpack_require__(27);
268
- var http_1 = __webpack_require__(28);
288
+ var jsonp_timeline_1 = __webpack_require__(18);
289
+ var transports_1 = __webpack_require__(19);
290
+ var net_info_1 = __webpack_require__(26);
291
+ var default_strategy_1 = __webpack_require__(27);
292
+ var transport_connection_initializer_1 = __webpack_require__(28);
293
+ var http_1 = __webpack_require__(29);
269
294
  var Runtime = {
270
295
  nextAuthCallbackID: 1,
271
296
  auth_callbacks: {},
@@ -392,9 +417,9 @@ return /******/ (function(modules) { // webpackBootstrap
392
417
  exports["default"] = Runtime;
393
418
 
394
419
 
395
- /***/ },
420
+ /***/ }),
396
421
  /* 3 */
397
- /***/ function(module, exports, __webpack_require__) {
422
+ /***/ (function(module, exports, __webpack_require__) {
398
423
 
399
424
  "use strict";
400
425
  var script_receiver_factory_1 = __webpack_require__(4);
@@ -410,9 +435,9 @@ return /******/ (function(modules) { // webpackBootstrap
410
435
  });
411
436
 
412
437
 
413
- /***/ },
438
+ /***/ }),
414
439
  /* 4 */
415
- /***/ function(module, exports) {
440
+ /***/ (function(module, exports) {
416
441
 
417
442
  "use strict";
418
443
  var ScriptReceiverFactory = (function () {
@@ -445,13 +470,13 @@ return /******/ (function(modules) { // webpackBootstrap
445
470
  exports.ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
446
471
 
447
472
 
448
- /***/ },
473
+ /***/ }),
449
474
  /* 5 */
450
- /***/ function(module, exports) {
475
+ /***/ (function(module, exports) {
451
476
 
452
477
  "use strict";
453
478
  var Defaults = {
454
- VERSION: "3.2.1",
479
+ VERSION: "4.2.1",
455
480
  PROTOCOL: 7,
456
481
  host: 'ws.pusherapp.com',
457
482
  ws_port: 80,
@@ -474,9 +499,9 @@ return /******/ (function(modules) { // webpackBootstrap
474
499
  exports["default"] = Defaults;
475
500
 
476
501
 
477
- /***/ },
502
+ /***/ }),
478
503
  /* 6 */
479
- /***/ function(module, exports, __webpack_require__) {
504
+ /***/ (function(module, exports, __webpack_require__) {
480
505
 
481
506
  "use strict";
482
507
  var script_receiver_factory_1 = __webpack_require__(4);
@@ -534,13 +559,14 @@ return /******/ (function(modules) { // webpackBootstrap
534
559
  exports["default"] = DependencyLoader;
535
560
 
536
561
 
537
- /***/ },
562
+ /***/ }),
538
563
  /* 7 */
539
- /***/ function(module, exports, __webpack_require__) {
564
+ /***/ (function(module, exports, __webpack_require__) {
540
565
 
541
566
  "use strict";
542
567
  var logger_1 = __webpack_require__(8);
543
568
  var runtime_1 = __webpack_require__(2);
569
+ var url_store_1 = __webpack_require__(14);
544
570
  var ajax = function (context, socketId, callback) {
545
571
  var self = this, xhr;
546
572
  xhr = runtime_1["default"].createXHR();
@@ -565,7 +591,9 @@ return /******/ (function(modules) { // webpackBootstrap
565
591
  }
566
592
  }
567
593
  else {
568
- logger_1["default"].warn("Couldn't get auth info from your webapp", xhr.status);
594
+ var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
595
+ logger_1["default"].warn(("Couldn't retrieve authentication info. " + xhr.status) +
596
+ ("Clients must be authenticated to join private or presence channels. " + suffix));
569
597
  callback(true, xhr.status);
570
598
  }
571
599
  }
@@ -577,9 +605,9 @@ return /******/ (function(modules) { // webpackBootstrap
577
605
  exports["default"] = ajax;
578
606
 
579
607
 
580
- /***/ },
608
+ /***/ }),
581
609
  /* 8 */
582
- /***/ function(module, exports, __webpack_require__) {
610
+ /***/ (function(module, exports, __webpack_require__) {
583
611
 
584
612
  "use strict";
585
613
  var collections_1 = __webpack_require__(9);
@@ -618,9 +646,9 @@ return /******/ (function(modules) { // webpackBootstrap
618
646
  exports["default"] = Logger;
619
647
 
620
648
 
621
- /***/ },
649
+ /***/ }),
622
650
  /* 9 */
623
- /***/ function(module, exports, __webpack_require__) {
651
+ /***/ (function(module, exports, __webpack_require__) {
624
652
 
625
653
  "use strict";
626
654
  var base64_1 = __webpack_require__(10);
@@ -834,9 +862,9 @@ return /******/ (function(modules) { // webpackBootstrap
834
862
  exports.safeJSONStringify = safeJSONStringify;
835
863
 
836
864
 
837
- /***/ },
865
+ /***/ }),
838
866
  /* 10 */
839
- /***/ function(module, exports, __webpack_require__) {
867
+ /***/ (function(module, exports, __webpack_require__) {
840
868
 
841
869
  "use strict";
842
870
  function encode(s) {
@@ -880,9 +908,9 @@ return /******/ (function(modules) { // webpackBootstrap
880
908
  };
881
909
 
882
910
 
883
- /***/ },
911
+ /***/ }),
884
912
  /* 11 */
885
- /***/ function(module, exports, __webpack_require__) {
913
+ /***/ (function(module, exports, __webpack_require__) {
886
914
 
887
915
  "use strict";
888
916
  var timers_1 = __webpack_require__(12);
@@ -913,9 +941,9 @@ return /******/ (function(modules) { // webpackBootstrap
913
941
  exports["default"] = Util;
914
942
 
915
943
 
916
- /***/ },
944
+ /***/ }),
917
945
  /* 12 */
918
- /***/ function(module, exports, __webpack_require__) {
946
+ /***/ (function(module, exports, __webpack_require__) {
919
947
 
920
948
  "use strict";
921
949
  var __extends = (this && this.__extends) || function (d, b) {
@@ -954,9 +982,9 @@ return /******/ (function(modules) { // webpackBootstrap
954
982
  exports.PeriodicTimer = PeriodicTimer;
955
983
 
956
984
 
957
- /***/ },
985
+ /***/ }),
958
986
  /* 13 */
959
- /***/ function(module, exports) {
987
+ /***/ (function(module, exports) {
960
988
 
961
989
  "use strict";
962
990
  var Timer = (function () {
@@ -984,9 +1012,45 @@ return /******/ (function(modules) { // webpackBootstrap
984
1012
  exports["default"] = Timer;
985
1013
 
986
1014
 
987
- /***/ },
1015
+ /***/ }),
988
1016
  /* 14 */
989
- /***/ function(module, exports, __webpack_require__) {
1017
+ /***/ (function(module, exports) {
1018
+
1019
+ "use strict";
1020
+ var urlStore = {
1021
+ baseUrl: "https://pusher.com",
1022
+ urls: {
1023
+ authenticationEndpoint: {
1024
+ path: "/docs/authenticating_users"
1025
+ },
1026
+ javascriptQuickStart: {
1027
+ path: "/docs/javascript_quick_start"
1028
+ }
1029
+ }
1030
+ };
1031
+ var buildLogSuffix = function (key) {
1032
+ var urlPrefix = "See:";
1033
+ var urlObj = urlStore.urls[key];
1034
+ if (!urlObj)
1035
+ return "";
1036
+ var url;
1037
+ if (urlObj.fullUrl) {
1038
+ url = urlObj.fullUrl;
1039
+ }
1040
+ else if (urlObj.path) {
1041
+ url = urlStore.baseUrl + urlObj.path;
1042
+ }
1043
+ if (!url)
1044
+ return "";
1045
+ return urlPrefix + " " + url;
1046
+ };
1047
+ exports.__esModule = true;
1048
+ exports["default"] = { buildLogSuffix: buildLogSuffix };
1049
+
1050
+
1051
+ /***/ }),
1052
+ /* 15 */
1053
+ /***/ (function(module, exports, __webpack_require__) {
990
1054
 
991
1055
  "use strict";
992
1056
  var logger_1 = __webpack_require__(8);
@@ -1014,9 +1078,9 @@ return /******/ (function(modules) { // webpackBootstrap
1014
1078
  exports["default"] = jsonp;
1015
1079
 
1016
1080
 
1017
- /***/ },
1018
- /* 15 */
1019
- /***/ function(module, exports) {
1081
+ /***/ }),
1082
+ /* 16 */
1083
+ /***/ (function(module, exports) {
1020
1084
 
1021
1085
  "use strict";
1022
1086
  var ScriptRequest = (function () {
@@ -1083,9 +1147,9 @@ return /******/ (function(modules) { // webpackBootstrap
1083
1147
  exports["default"] = ScriptRequest;
1084
1148
 
1085
1149
 
1086
- /***/ },
1087
- /* 16 */
1088
- /***/ function(module, exports, __webpack_require__) {
1150
+ /***/ }),
1151
+ /* 17 */
1152
+ /***/ (function(module, exports, __webpack_require__) {
1089
1153
 
1090
1154
  "use strict";
1091
1155
  var Collections = __webpack_require__(9);
@@ -1115,9 +1179,9 @@ return /******/ (function(modules) { // webpackBootstrap
1115
1179
  exports["default"] = JSONPRequest;
1116
1180
 
1117
1181
 
1118
- /***/ },
1119
- /* 17 */
1120
- /***/ function(module, exports, __webpack_require__) {
1182
+ /***/ }),
1183
+ /* 18 */
1184
+ /***/ (function(module, exports, __webpack_require__) {
1121
1185
 
1122
1186
  "use strict";
1123
1187
  var runtime_1 = __webpack_require__(2);
@@ -1148,14 +1212,14 @@ return /******/ (function(modules) { // webpackBootstrap
1148
1212
  exports["default"] = jsonp;
1149
1213
 
1150
1214
 
1151
- /***/ },
1152
- /* 18 */
1153
- /***/ function(module, exports, __webpack_require__) {
1215
+ /***/ }),
1216
+ /* 19 */
1217
+ /***/ (function(module, exports, __webpack_require__) {
1154
1218
 
1155
1219
  "use strict";
1156
- var transports_1 = __webpack_require__(19);
1157
- var transport_1 = __webpack_require__(21);
1158
- var URLSchemes = __webpack_require__(20);
1220
+ var transports_1 = __webpack_require__(20);
1221
+ var transport_1 = __webpack_require__(22);
1222
+ var URLSchemes = __webpack_require__(21);
1159
1223
  var runtime_1 = __webpack_require__(2);
1160
1224
  var dependencies_1 = __webpack_require__(3);
1161
1225
  var Collections = __webpack_require__(9);
@@ -1199,13 +1263,13 @@ return /******/ (function(modules) { // webpackBootstrap
1199
1263
  exports["default"] = transports_1["default"];
1200
1264
 
1201
1265
 
1202
- /***/ },
1203
- /* 19 */
1204
- /***/ function(module, exports, __webpack_require__) {
1266
+ /***/ }),
1267
+ /* 20 */
1268
+ /***/ (function(module, exports, __webpack_require__) {
1205
1269
 
1206
1270
  "use strict";
1207
- var URLSchemes = __webpack_require__(20);
1208
- var transport_1 = __webpack_require__(21);
1271
+ var URLSchemes = __webpack_require__(21);
1272
+ var transport_1 = __webpack_require__(22);
1209
1273
  var Collections = __webpack_require__(9);
1210
1274
  var runtime_1 = __webpack_require__(2);
1211
1275
  var WSTransport = new transport_1["default"]({
@@ -1254,9 +1318,9 @@ return /******/ (function(modules) { // webpackBootstrap
1254
1318
  exports["default"] = Transports;
1255
1319
 
1256
1320
 
1257
- /***/ },
1258
- /* 20 */
1259
- /***/ function(module, exports, __webpack_require__) {
1321
+ /***/ }),
1322
+ /* 21 */
1323
+ /***/ (function(module, exports, __webpack_require__) {
1260
1324
 
1261
1325
  "use strict";
1262
1326
  var defaults_1 = __webpack_require__(5);
@@ -1294,12 +1358,12 @@ return /******/ (function(modules) { // webpackBootstrap
1294
1358
  };
1295
1359
 
1296
1360
 
1297
- /***/ },
1298
- /* 21 */
1299
- /***/ function(module, exports, __webpack_require__) {
1361
+ /***/ }),
1362
+ /* 22 */
1363
+ /***/ (function(module, exports, __webpack_require__) {
1300
1364
 
1301
1365
  "use strict";
1302
- var transport_connection_1 = __webpack_require__(22);
1366
+ var transport_connection_1 = __webpack_require__(23);
1303
1367
  var Transport = (function () {
1304
1368
  function Transport(hooks) {
1305
1369
  this.hooks = hooks;
@@ -1316,9 +1380,9 @@ return /******/ (function(modules) { // webpackBootstrap
1316
1380
  exports["default"] = Transport;
1317
1381
 
1318
1382
 
1319
- /***/ },
1320
- /* 22 */
1321
- /***/ function(module, exports, __webpack_require__) {
1383
+ /***/ }),
1384
+ /* 23 */
1385
+ /***/ (function(module, exports, __webpack_require__) {
1322
1386
 
1323
1387
  "use strict";
1324
1388
  var __extends = (this && this.__extends) || function (d, b) {
@@ -1328,7 +1392,7 @@ return /******/ (function(modules) { // webpackBootstrap
1328
1392
  };
1329
1393
  var util_1 = __webpack_require__(11);
1330
1394
  var Collections = __webpack_require__(9);
1331
- var dispatcher_1 = __webpack_require__(23);
1395
+ var dispatcher_1 = __webpack_require__(24);
1332
1396
  var logger_1 = __webpack_require__(8);
1333
1397
  var runtime_1 = __webpack_require__(2);
1334
1398
  var TransportConnection = (function (_super) {
@@ -1478,12 +1542,13 @@ return /******/ (function(modules) { // webpackBootstrap
1478
1542
  exports["default"] = TransportConnection;
1479
1543
 
1480
1544
 
1481
- /***/ },
1482
- /* 23 */
1483
- /***/ function(module, exports, __webpack_require__) {
1545
+ /***/ }),
1546
+ /* 24 */
1547
+ /***/ (function(module, exports, __webpack_require__) {
1484
1548
 
1485
1549
  "use strict";
1486
- var callback_registry_1 = __webpack_require__(24);
1550
+ var Collections = __webpack_require__(9);
1551
+ var callback_registry_1 = __webpack_require__(25);
1487
1552
  var Dispatcher = (function () {
1488
1553
  function Dispatcher(failThrough) {
1489
1554
  this.callbacks = new callback_registry_1["default"]();
@@ -1494,7 +1559,7 @@ return /******/ (function(modules) { // webpackBootstrap
1494
1559
  this.callbacks.add(eventName, callback, context);
1495
1560
  return this;
1496
1561
  };
1497
- Dispatcher.prototype.bind_all = function (callback) {
1562
+ Dispatcher.prototype.bind_global = function (callback) {
1498
1563
  this.global_callbacks.push(callback);
1499
1564
  return this;
1500
1565
  };
@@ -1502,8 +1567,17 @@ return /******/ (function(modules) { // webpackBootstrap
1502
1567
  this.callbacks.remove(eventName, callback, context);
1503
1568
  return this;
1504
1569
  };
1505
- Dispatcher.prototype.unbind_all = function (eventName, callback) {
1506
- this.callbacks.remove(eventName, callback);
1570
+ Dispatcher.prototype.unbind_global = function (callback) {
1571
+ if (!callback) {
1572
+ this.global_callbacks = [];
1573
+ return this;
1574
+ }
1575
+ this.global_callbacks = Collections.filter(this.global_callbacks || [], function (c) { return c !== callback; });
1576
+ return this;
1577
+ };
1578
+ Dispatcher.prototype.unbind_all = function () {
1579
+ this.unbind();
1580
+ this.unbind_global();
1507
1581
  return this;
1508
1582
  };
1509
1583
  Dispatcher.prototype.emit = function (eventName, data) {
@@ -1528,9 +1602,9 @@ return /******/ (function(modules) { // webpackBootstrap
1528
1602
  exports["default"] = Dispatcher;
1529
1603
 
1530
1604
 
1531
- /***/ },
1532
- /* 24 */
1533
- /***/ function(module, exports, __webpack_require__) {
1605
+ /***/ }),
1606
+ /* 25 */
1607
+ /***/ (function(module, exports, __webpack_require__) {
1534
1608
 
1535
1609
  "use strict";
1536
1610
  var Collections = __webpack_require__(9);
@@ -1587,9 +1661,9 @@ return /******/ (function(modules) { // webpackBootstrap
1587
1661
  }
1588
1662
 
1589
1663
 
1590
- /***/ },
1591
- /* 25 */
1592
- /***/ function(module, exports, __webpack_require__) {
1664
+ /***/ }),
1665
+ /* 26 */
1666
+ /***/ (function(module, exports, __webpack_require__) {
1593
1667
 
1594
1668
  "use strict";
1595
1669
  var __extends = (this && this.__extends) || function (d, b) {
@@ -1597,7 +1671,7 @@ return /******/ (function(modules) { // webpackBootstrap
1597
1671
  function __() { this.constructor = d; }
1598
1672
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1599
1673
  };
1600
- var dispatcher_1 = __webpack_require__(23);
1674
+ var dispatcher_1 = __webpack_require__(24);
1601
1675
  var NetInfo = (function (_super) {
1602
1676
  __extends(NetInfo, _super);
1603
1677
  function NetInfo() {
@@ -1626,9 +1700,9 @@ return /******/ (function(modules) { // webpackBootstrap
1626
1700
  exports.Network = new NetInfo();
1627
1701
 
1628
1702
 
1629
- /***/ },
1630
- /* 26 */
1631
- /***/ function(module, exports) {
1703
+ /***/ }),
1704
+ /* 27 */
1705
+ /***/ (function(module, exports) {
1632
1706
 
1633
1707
  "use strict";
1634
1708
  var getDefaultStrategy = function (config) {
@@ -1728,9 +1802,9 @@ return /******/ (function(modules) { // webpackBootstrap
1728
1802
  exports["default"] = getDefaultStrategy;
1729
1803
 
1730
1804
 
1731
- /***/ },
1732
- /* 27 */
1733
- /***/ function(module, exports, __webpack_require__) {
1805
+ /***/ }),
1806
+ /* 28 */
1807
+ /***/ (function(module, exports, __webpack_require__) {
1734
1808
 
1735
1809
  "use strict";
1736
1810
  var dependencies_1 = __webpack_require__(3);
@@ -1766,13 +1840,13 @@ return /******/ (function(modules) { // webpackBootstrap
1766
1840
  exports["default"] = default_1;
1767
1841
 
1768
1842
 
1769
- /***/ },
1770
- /* 28 */
1771
- /***/ function(module, exports, __webpack_require__) {
1843
+ /***/ }),
1844
+ /* 29 */
1845
+ /***/ (function(module, exports, __webpack_require__) {
1772
1846
 
1773
1847
  "use strict";
1774
- var http_xdomain_request_1 = __webpack_require__(29);
1775
- var http_1 = __webpack_require__(31);
1848
+ var http_xdomain_request_1 = __webpack_require__(30);
1849
+ var http_1 = __webpack_require__(32);
1776
1850
  http_1["default"].createXDR = function (method, url) {
1777
1851
  return this.createRequest(http_xdomain_request_1["default"], method, url);
1778
1852
  };
@@ -1780,12 +1854,12 @@ return /******/ (function(modules) { // webpackBootstrap
1780
1854
  exports["default"] = http_1["default"];
1781
1855
 
1782
1856
 
1783
- /***/ },
1784
- /* 29 */
1785
- /***/ function(module, exports, __webpack_require__) {
1857
+ /***/ }),
1858
+ /* 30 */
1859
+ /***/ (function(module, exports, __webpack_require__) {
1786
1860
 
1787
1861
  "use strict";
1788
- var Errors = __webpack_require__(30);
1862
+ var Errors = __webpack_require__(31);
1789
1863
  var hooks = {
1790
1864
  getRequest: function (socket) {
1791
1865
  var xdr = new window.XDomainRequest();
@@ -1820,9 +1894,9 @@ return /******/ (function(modules) { // webpackBootstrap
1820
1894
  exports["default"] = hooks;
1821
1895
 
1822
1896
 
1823
- /***/ },
1824
- /* 30 */
1825
- /***/ function(module, exports) {
1897
+ /***/ }),
1898
+ /* 31 */
1899
+ /***/ (function(module, exports) {
1826
1900
 
1827
1901
  "use strict";
1828
1902
  var __extends = (this && this.__extends) || function (d, b) {
@@ -1880,16 +1954,16 @@ return /******/ (function(modules) { // webpackBootstrap
1880
1954
  exports.UnsupportedStrategy = UnsupportedStrategy;
1881
1955
 
1882
1956
 
1883
- /***/ },
1884
- /* 31 */
1885
- /***/ function(module, exports, __webpack_require__) {
1957
+ /***/ }),
1958
+ /* 32 */
1959
+ /***/ (function(module, exports, __webpack_require__) {
1886
1960
 
1887
1961
  "use strict";
1888
- var http_request_1 = __webpack_require__(32);
1889
- var http_socket_1 = __webpack_require__(33);
1890
- var http_streaming_socket_1 = __webpack_require__(35);
1891
- var http_polling_socket_1 = __webpack_require__(36);
1892
- var http_xhr_request_1 = __webpack_require__(37);
1962
+ var http_request_1 = __webpack_require__(33);
1963
+ var http_socket_1 = __webpack_require__(34);
1964
+ var http_streaming_socket_1 = __webpack_require__(36);
1965
+ var http_polling_socket_1 = __webpack_require__(37);
1966
+ var http_xhr_request_1 = __webpack_require__(38);
1893
1967
  var HTTP = {
1894
1968
  createStreamingSocket: function (url) {
1895
1969
  return this.createSocket(http_streaming_socket_1["default"], url);
@@ -1911,9 +1985,9 @@ return /******/ (function(modules) { // webpackBootstrap
1911
1985
  exports["default"] = HTTP;
1912
1986
 
1913
1987
 
1914
- /***/ },
1915
- /* 32 */
1916
- /***/ function(module, exports, __webpack_require__) {
1988
+ /***/ }),
1989
+ /* 33 */
1990
+ /***/ (function(module, exports, __webpack_require__) {
1917
1991
 
1918
1992
  "use strict";
1919
1993
  var __extends = (this && this.__extends) || function (d, b) {
@@ -1922,7 +1996,7 @@ return /******/ (function(modules) { // webpackBootstrap
1922
1996
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1923
1997
  };
1924
1998
  var runtime_1 = __webpack_require__(2);
1925
- var dispatcher_1 = __webpack_require__(23);
1999
+ var dispatcher_1 = __webpack_require__(24);
1926
2000
  var MAX_BUFFER_LENGTH = 256 * 1024;
1927
2001
  var HTTPRequest = (function (_super) {
1928
2002
  __extends(HTTPRequest, _super);
@@ -1990,12 +2064,12 @@ return /******/ (function(modules) { // webpackBootstrap
1990
2064
  exports["default"] = HTTPRequest;
1991
2065
 
1992
2066
 
1993
- /***/ },
1994
- /* 33 */
1995
- /***/ function(module, exports, __webpack_require__) {
2067
+ /***/ }),
2068
+ /* 34 */
2069
+ /***/ (function(module, exports, __webpack_require__) {
1996
2070
 
1997
2071
  "use strict";
1998
- var state_1 = __webpack_require__(34);
2072
+ var state_1 = __webpack_require__(35);
1999
2073
  var util_1 = __webpack_require__(11);
2000
2074
  var runtime_1 = __webpack_require__(2);
2001
2075
  var autoIncrement = 1;
@@ -2171,9 +2245,9 @@ return /******/ (function(modules) { // webpackBootstrap
2171
2245
  exports["default"] = HTTPSocket;
2172
2246
 
2173
2247
 
2174
- /***/ },
2175
- /* 34 */
2176
- /***/ function(module, exports) {
2248
+ /***/ }),
2249
+ /* 35 */
2250
+ /***/ (function(module, exports) {
2177
2251
 
2178
2252
  "use strict";
2179
2253
  var State;
@@ -2186,9 +2260,9 @@ return /******/ (function(modules) { // webpackBootstrap
2186
2260
  exports["default"] = State;
2187
2261
 
2188
2262
 
2189
- /***/ },
2190
- /* 35 */
2191
- /***/ function(module, exports) {
2263
+ /***/ }),
2264
+ /* 36 */
2265
+ /***/ (function(module, exports) {
2192
2266
 
2193
2267
  "use strict";
2194
2268
  var hooks = {
@@ -2209,9 +2283,9 @@ return /******/ (function(modules) { // webpackBootstrap
2209
2283
  exports["default"] = hooks;
2210
2284
 
2211
2285
 
2212
- /***/ },
2213
- /* 36 */
2214
- /***/ function(module, exports) {
2286
+ /***/ }),
2287
+ /* 37 */
2288
+ /***/ (function(module, exports) {
2215
2289
 
2216
2290
  "use strict";
2217
2291
  var hooks = {
@@ -2236,9 +2310,9 @@ return /******/ (function(modules) { // webpackBootstrap
2236
2310
  exports["default"] = hooks;
2237
2311
 
2238
2312
 
2239
- /***/ },
2240
- /* 37 */
2241
- /***/ function(module, exports, __webpack_require__) {
2313
+ /***/ }),
2314
+ /* 38 */
2315
+ /***/ (function(module, exports, __webpack_require__) {
2242
2316
 
2243
2317
  "use strict";
2244
2318
  var runtime_1 = __webpack_require__(2);
@@ -2273,14 +2347,14 @@ return /******/ (function(modules) { // webpackBootstrap
2273
2347
  exports["default"] = hooks;
2274
2348
 
2275
2349
 
2276
- /***/ },
2277
- /* 38 */
2278
- /***/ function(module, exports, __webpack_require__) {
2350
+ /***/ }),
2351
+ /* 39 */
2352
+ /***/ (function(module, exports, __webpack_require__) {
2279
2353
 
2280
2354
  "use strict";
2281
2355
  var Collections = __webpack_require__(9);
2282
2356
  var util_1 = __webpack_require__(11);
2283
- var level_1 = __webpack_require__(39);
2357
+ var level_1 = __webpack_require__(40);
2284
2358
  var Timeline = (function () {
2285
2359
  function Timeline(key, session, options) {
2286
2360
  this.key = key;
@@ -2343,9 +2417,9 @@ return /******/ (function(modules) { // webpackBootstrap
2343
2417
  exports["default"] = Timeline;
2344
2418
 
2345
2419
 
2346
- /***/ },
2347
- /* 39 */
2348
- /***/ function(module, exports) {
2420
+ /***/ }),
2421
+ /* 40 */
2422
+ /***/ (function(module, exports) {
2349
2423
 
2350
2424
  "use strict";
2351
2425
  var TimelineLevel;
@@ -2358,22 +2432,22 @@ return /******/ (function(modules) { // webpackBootstrap
2358
2432
  exports["default"] = TimelineLevel;
2359
2433
 
2360
2434
 
2361
- /***/ },
2362
- /* 40 */
2363
- /***/ function(module, exports, __webpack_require__) {
2435
+ /***/ }),
2436
+ /* 41 */
2437
+ /***/ (function(module, exports, __webpack_require__) {
2364
2438
 
2365
2439
  "use strict";
2366
2440
  var Collections = __webpack_require__(9);
2367
2441
  var util_1 = __webpack_require__(11);
2368
- var transport_manager_1 = __webpack_require__(41);
2369
- var Errors = __webpack_require__(30);
2370
- var transport_strategy_1 = __webpack_require__(55);
2371
- var sequential_strategy_1 = __webpack_require__(56);
2372
- var best_connected_ever_strategy_1 = __webpack_require__(57);
2373
- var cached_strategy_1 = __webpack_require__(58);
2374
- var delayed_strategy_1 = __webpack_require__(59);
2375
- var if_strategy_1 = __webpack_require__(60);
2376
- var first_connected_strategy_1 = __webpack_require__(61);
2442
+ var transport_manager_1 = __webpack_require__(42);
2443
+ var Errors = __webpack_require__(31);
2444
+ var transport_strategy_1 = __webpack_require__(56);
2445
+ var sequential_strategy_1 = __webpack_require__(57);
2446
+ var best_connected_ever_strategy_1 = __webpack_require__(58);
2447
+ var cached_strategy_1 = __webpack_require__(59);
2448
+ var delayed_strategy_1 = __webpack_require__(60);
2449
+ var if_strategy_1 = __webpack_require__(61);
2450
+ var first_connected_strategy_1 = __webpack_require__(62);
2377
2451
  var runtime_1 = __webpack_require__(2);
2378
2452
  var Transports = runtime_1["default"].Transports;
2379
2453
  exports.build = function (scheme, options) {
@@ -2528,12 +2602,12 @@ return /******/ (function(modules) { // webpackBootstrap
2528
2602
  }
2529
2603
 
2530
2604
 
2531
- /***/ },
2532
- /* 41 */
2533
- /***/ function(module, exports, __webpack_require__) {
2605
+ /***/ }),
2606
+ /* 42 */
2607
+ /***/ (function(module, exports, __webpack_require__) {
2534
2608
 
2535
2609
  "use strict";
2536
- var factory_1 = __webpack_require__(42);
2610
+ var factory_1 = __webpack_require__(43);
2537
2611
  var TransportManager = (function () {
2538
2612
  function TransportManager(options) {
2539
2613
  this.options = options || {};
@@ -2557,20 +2631,20 @@ return /******/ (function(modules) { // webpackBootstrap
2557
2631
  exports["default"] = TransportManager;
2558
2632
 
2559
2633
 
2560
- /***/ },
2561
- /* 42 */
2562
- /***/ function(module, exports, __webpack_require__) {
2563
-
2564
- "use strict";
2565
- var assistant_to_the_transport_manager_1 = __webpack_require__(43);
2566
- var handshake_1 = __webpack_require__(44);
2567
- var pusher_authorizer_1 = __webpack_require__(47);
2568
- var timeline_sender_1 = __webpack_require__(48);
2569
- var presence_channel_1 = __webpack_require__(49);
2570
- var private_channel_1 = __webpack_require__(50);
2571
- var channel_1 = __webpack_require__(51);
2572
- var connection_manager_1 = __webpack_require__(53);
2573
- var channels_1 = __webpack_require__(54);
2634
+ /***/ }),
2635
+ /* 43 */
2636
+ /***/ (function(module, exports, __webpack_require__) {
2637
+
2638
+ "use strict";
2639
+ var assistant_to_the_transport_manager_1 = __webpack_require__(44);
2640
+ var handshake_1 = __webpack_require__(45);
2641
+ var pusher_authorizer_1 = __webpack_require__(48);
2642
+ var timeline_sender_1 = __webpack_require__(49);
2643
+ var presence_channel_1 = __webpack_require__(50);
2644
+ var private_channel_1 = __webpack_require__(51);
2645
+ var channel_1 = __webpack_require__(52);
2646
+ var connection_manager_1 = __webpack_require__(54);
2647
+ var channels_1 = __webpack_require__(55);
2574
2648
  var Factory = {
2575
2649
  createChannels: function () {
2576
2650
  return new channels_1["default"]();
@@ -2591,6 +2665,9 @@ return /******/ (function(modules) { // webpackBootstrap
2591
2665
  return new timeline_sender_1["default"](timeline, options);
2592
2666
  },
2593
2667
  createAuthorizer: function (channel, options) {
2668
+ if (options.authorizer) {
2669
+ return options.authorizer(channel, options);
2670
+ }
2594
2671
  return new pusher_authorizer_1["default"](channel, options);
2595
2672
  },
2596
2673
  createHandshake: function (transport, callback) {
@@ -2604,9 +2681,9 @@ return /******/ (function(modules) { // webpackBootstrap
2604
2681
  exports["default"] = Factory;
2605
2682
 
2606
2683
 
2607
- /***/ },
2608
- /* 43 */
2609
- /***/ function(module, exports, __webpack_require__) {
2684
+ /***/ }),
2685
+ /* 44 */
2686
+ /***/ (function(module, exports, __webpack_require__) {
2610
2687
 
2611
2688
  "use strict";
2612
2689
  var util_1 = __webpack_require__(11);
@@ -2656,14 +2733,14 @@ return /******/ (function(modules) { // webpackBootstrap
2656
2733
  exports["default"] = AssistantToTheTransportManager;
2657
2734
 
2658
2735
 
2659
- /***/ },
2660
- /* 44 */
2661
- /***/ function(module, exports, __webpack_require__) {
2736
+ /***/ }),
2737
+ /* 45 */
2738
+ /***/ (function(module, exports, __webpack_require__) {
2662
2739
 
2663
2740
  "use strict";
2664
2741
  var Collections = __webpack_require__(9);
2665
- var Protocol = __webpack_require__(45);
2666
- var connection_1 = __webpack_require__(46);
2742
+ var Protocol = __webpack_require__(46);
2743
+ var connection_1 = __webpack_require__(47);
2667
2744
  var Handshake = (function () {
2668
2745
  function Handshake(transport, callback) {
2669
2746
  this.transport = transport;
@@ -2720,9 +2797,9 @@ return /******/ (function(modules) { // webpackBootstrap
2720
2797
  exports["default"] = Handshake;
2721
2798
 
2722
2799
 
2723
- /***/ },
2724
- /* 45 */
2725
- /***/ function(module, exports) {
2800
+ /***/ }),
2801
+ /* 46 */
2802
+ /***/ (function(module, exports) {
2726
2803
 
2727
2804
  "use strict";
2728
2805
  exports.decodeMessage = function (message) {
@@ -2810,9 +2887,9 @@ return /******/ (function(modules) { // webpackBootstrap
2810
2887
  };
2811
2888
 
2812
2889
 
2813
- /***/ },
2814
- /* 46 */
2815
- /***/ function(module, exports, __webpack_require__) {
2890
+ /***/ }),
2891
+ /* 47 */
2892
+ /***/ (function(module, exports, __webpack_require__) {
2816
2893
 
2817
2894
  "use strict";
2818
2895
  var __extends = (this && this.__extends) || function (d, b) {
@@ -2821,8 +2898,8 @@ return /******/ (function(modules) { // webpackBootstrap
2821
2898
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2822
2899
  };
2823
2900
  var Collections = __webpack_require__(9);
2824
- var dispatcher_1 = __webpack_require__(23);
2825
- var Protocol = __webpack_require__(45);
2901
+ var dispatcher_1 = __webpack_require__(24);
2902
+ var Protocol = __webpack_require__(46);
2826
2903
  var logger_1 = __webpack_require__(8);
2827
2904
  var Connection = (function (_super) {
2828
2905
  __extends(Connection, _super);
@@ -2929,14 +3006,14 @@ return /******/ (function(modules) { // webpackBootstrap
2929
3006
  exports["default"] = Connection;
2930
3007
 
2931
3008
 
2932
- /***/ },
2933
- /* 47 */
2934
- /***/ function(module, exports, __webpack_require__) {
3009
+ /***/ }),
3010
+ /* 48 */
3011
+ /***/ (function(module, exports, __webpack_require__) {
2935
3012
 
2936
3013
  "use strict";
2937
3014
  var runtime_1 = __webpack_require__(2);
2938
- var Authorizer = (function () {
2939
- function Authorizer(channel, options) {
3015
+ var PusherAuthorizer = (function () {
3016
+ function PusherAuthorizer(channel, options) {
2940
3017
  this.channel = channel;
2941
3018
  var authTransport = options.authTransport;
2942
3019
  if (typeof runtime_1["default"].getAuthorizers()[authTransport] === "undefined") {
@@ -2946,7 +3023,7 @@ return /******/ (function(modules) { // webpackBootstrap
2946
3023
  this.options = options;
2947
3024
  this.authOptions = (options || {}).auth || {};
2948
3025
  }
2949
- Authorizer.prototype.composeQuery = function (socketId) {
3026
+ PusherAuthorizer.prototype.composeQuery = function (socketId) {
2950
3027
  var query = 'socket_id=' + encodeURIComponent(socketId) +
2951
3028
  '&channel_name=' + encodeURIComponent(this.channel.name);
2952
3029
  for (var i in this.authOptions.params) {
@@ -2954,19 +3031,19 @@ return /******/ (function(modules) { // webpackBootstrap
2954
3031
  }
2955
3032
  return query;
2956
3033
  };
2957
- Authorizer.prototype.authorize = function (socketId, callback) {
2958
- Authorizer.authorizers = Authorizer.authorizers || runtime_1["default"].getAuthorizers();
2959
- return Authorizer.authorizers[this.type].call(this, runtime_1["default"], socketId, callback);
3034
+ PusherAuthorizer.prototype.authorize = function (socketId, callback) {
3035
+ PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime_1["default"].getAuthorizers();
3036
+ return PusherAuthorizer.authorizers[this.type].call(this, runtime_1["default"], socketId, callback);
2960
3037
  };
2961
- return Authorizer;
3038
+ return PusherAuthorizer;
2962
3039
  }());
2963
3040
  exports.__esModule = true;
2964
- exports["default"] = Authorizer;
3041
+ exports["default"] = PusherAuthorizer;
2965
3042
 
2966
3043
 
2967
- /***/ },
2968
- /* 48 */
2969
- /***/ function(module, exports, __webpack_require__) {
3044
+ /***/ }),
3045
+ /* 49 */
3046
+ /***/ (function(module, exports, __webpack_require__) {
2970
3047
 
2971
3048
  "use strict";
2972
3049
  var runtime_1 = __webpack_require__(2);
@@ -2987,9 +3064,9 @@ return /******/ (function(modules) { // webpackBootstrap
2987
3064
  exports["default"] = TimelineSender;
2988
3065
 
2989
3066
 
2990
- /***/ },
2991
- /* 49 */
2992
- /***/ function(module, exports, __webpack_require__) {
3067
+ /***/ }),
3068
+ /* 50 */
3069
+ /***/ (function(module, exports, __webpack_require__) {
2993
3070
 
2994
3071
  "use strict";
2995
3072
  var __extends = (this && this.__extends) || function (d, b) {
@@ -2997,9 +3074,10 @@ return /******/ (function(modules) { // webpackBootstrap
2997
3074
  function __() { this.constructor = d; }
2998
3075
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2999
3076
  };
3000
- var private_channel_1 = __webpack_require__(50);
3077
+ var private_channel_1 = __webpack_require__(51);
3001
3078
  var logger_1 = __webpack_require__(8);
3002
- var members_1 = __webpack_require__(52);
3079
+ var members_1 = __webpack_require__(53);
3080
+ var url_store_1 = __webpack_require__(14);
3003
3081
  var PresenceChannel = (function (_super) {
3004
3082
  __extends(PresenceChannel, _super);
3005
3083
  function PresenceChannel(name, pusher) {
@@ -3011,9 +3089,9 @@ return /******/ (function(modules) { // webpackBootstrap
3011
3089
  _super.prototype.authorize.call(this, socketId, function (error, authData) {
3012
3090
  if (!error) {
3013
3091
  if (authData.channel_data === undefined) {
3014
- logger_1["default"].warn("Invalid auth response for channel '" +
3015
- _this.name +
3016
- "', expected 'channel_data' field");
3092
+ var suffix = url_store_1["default"].buildLogSuffix("authenticationEndpoint");
3093
+ logger_1["default"].warn(("Invalid auth response for channel '" + _this.name + "',") +
3094
+ ("expected 'channel_data' field. " + suffix));
3017
3095
  callback("Invalid auth response");
3018
3096
  return;
3019
3097
  }
@@ -3026,9 +3104,15 @@ return /******/ (function(modules) { // webpackBootstrap
3026
3104
  PresenceChannel.prototype.handleEvent = function (event, data) {
3027
3105
  switch (event) {
3028
3106
  case "pusher_internal:subscription_succeeded":
3029
- this.members.onSubscription(data);
3107
+ this.subscriptionPending = false;
3030
3108
  this.subscribed = true;
3031
- this.emit("pusher:subscription_succeeded", this.members);
3109
+ if (this.subscriptionCancelled) {
3110
+ this.pusher.unsubscribe(this.name);
3111
+ }
3112
+ else {
3113
+ this.members.onSubscription(data);
3114
+ this.emit("pusher:subscription_succeeded", this.members);
3115
+ }
3032
3116
  break;
3033
3117
  case "pusher_internal:member_added":
3034
3118
  var addedMember = this.members.addMember(data);
@@ -3054,9 +3138,9 @@ return /******/ (function(modules) { // webpackBootstrap
3054
3138
  exports["default"] = PresenceChannel;
3055
3139
 
3056
3140
 
3057
- /***/ },
3058
- /* 50 */
3059
- /***/ function(module, exports, __webpack_require__) {
3141
+ /***/ }),
3142
+ /* 51 */
3143
+ /***/ (function(module, exports, __webpack_require__) {
3060
3144
 
3061
3145
  "use strict";
3062
3146
  var __extends = (this && this.__extends) || function (d, b) {
@@ -3064,8 +3148,8 @@ return /******/ (function(modules) { // webpackBootstrap
3064
3148
  function __() { this.constructor = d; }
3065
3149
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3066
3150
  };
3067
- var factory_1 = __webpack_require__(42);
3068
- var channel_1 = __webpack_require__(51);
3151
+ var factory_1 = __webpack_require__(43);
3152
+ var channel_1 = __webpack_require__(52);
3069
3153
  var PrivateChannel = (function (_super) {
3070
3154
  __extends(PrivateChannel, _super);
3071
3155
  function PrivateChannel() {
@@ -3081,9 +3165,9 @@ return /******/ (function(modules) { // webpackBootstrap
3081
3165
  exports["default"] = PrivateChannel;
3082
3166
 
3083
3167
 
3084
- /***/ },
3085
- /* 51 */
3086
- /***/ function(module, exports, __webpack_require__) {
3168
+ /***/ }),
3169
+ /* 52 */
3170
+ /***/ (function(module, exports, __webpack_require__) {
3087
3171
 
3088
3172
  "use strict";
3089
3173
  var __extends = (this && this.__extends) || function (d, b) {
@@ -3091,8 +3175,8 @@ return /******/ (function(modules) { // webpackBootstrap
3091
3175
  function __() { this.constructor = d; }
3092
3176
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3093
3177
  };
3094
- var dispatcher_1 = __webpack_require__(23);
3095
- var Errors = __webpack_require__(30);
3178
+ var dispatcher_1 = __webpack_require__(24);
3179
+ var Errors = __webpack_require__(31);
3096
3180
  var logger_1 = __webpack_require__(8);
3097
3181
  var Channel = (function (_super) {
3098
3182
  __extends(Channel, _super);
@@ -3103,6 +3187,8 @@ return /******/ (function(modules) { // webpackBootstrap
3103
3187
  this.name = name;
3104
3188
  this.pusher = pusher;
3105
3189
  this.subscribed = false;
3190
+ this.subscriptionPending = false;
3191
+ this.subscriptionCancelled = false;
3106
3192
  }
3107
3193
  Channel.prototype.authorize = function (socketId, callback) {
3108
3194
  return callback(false, {});
@@ -3115,12 +3201,19 @@ return /******/ (function(modules) { // webpackBootstrap
3115
3201
  };
3116
3202
  Channel.prototype.disconnect = function () {
3117
3203
  this.subscribed = false;
3204
+ this.subscriptionPending = false;
3118
3205
  };
3119
3206
  Channel.prototype.handleEvent = function (event, data) {
3120
3207
  if (event.indexOf("pusher_internal:") === 0) {
3121
3208
  if (event === "pusher_internal:subscription_succeeded") {
3209
+ this.subscriptionPending = false;
3122
3210
  this.subscribed = true;
3123
- this.emit("pusher:subscription_succeeded", data);
3211
+ if (this.subscriptionCancelled) {
3212
+ this.pusher.unsubscribe(this.name);
3213
+ }
3214
+ else {
3215
+ this.emit("pusher:subscription_succeeded", data);
3216
+ }
3124
3217
  }
3125
3218
  }
3126
3219
  else {
@@ -3129,6 +3222,11 @@ return /******/ (function(modules) { // webpackBootstrap
3129
3222
  };
3130
3223
  Channel.prototype.subscribe = function () {
3131
3224
  var _this = this;
3225
+ if (this.subscribed) {
3226
+ return;
3227
+ }
3228
+ this.subscriptionPending = true;
3229
+ this.subscriptionCancelled = false;
3132
3230
  this.authorize(this.pusher.connection.socket_id, function (error, data) {
3133
3231
  if (error) {
3134
3232
  _this.handleEvent('pusher:subscription_error', data);
@@ -3143,19 +3241,26 @@ return /******/ (function(modules) { // webpackBootstrap
3143
3241
  });
3144
3242
  };
3145
3243
  Channel.prototype.unsubscribe = function () {
3244
+ this.subscribed = false;
3146
3245
  this.pusher.send_event('pusher:unsubscribe', {
3147
3246
  channel: this.name
3148
3247
  });
3149
3248
  };
3249
+ Channel.prototype.cancelSubscription = function () {
3250
+ this.subscriptionCancelled = true;
3251
+ };
3252
+ Channel.prototype.reinstateSubscription = function () {
3253
+ this.subscriptionCancelled = false;
3254
+ };
3150
3255
  return Channel;
3151
3256
  }(dispatcher_1["default"]));
3152
3257
  exports.__esModule = true;
3153
3258
  exports["default"] = Channel;
3154
3259
 
3155
3260
 
3156
- /***/ },
3157
- /* 52 */
3158
- /***/ function(module, exports, __webpack_require__) {
3261
+ /***/ }),
3262
+ /* 53 */
3263
+ /***/ (function(module, exports, __webpack_require__) {
3159
3264
 
3160
3265
  "use strict";
3161
3266
  var Collections = __webpack_require__(9);
@@ -3215,9 +3320,9 @@ return /******/ (function(modules) { // webpackBootstrap
3215
3320
  exports["default"] = Members;
3216
3321
 
3217
3322
 
3218
- /***/ },
3219
- /* 53 */
3220
- /***/ function(module, exports, __webpack_require__) {
3323
+ /***/ }),
3324
+ /* 54 */
3325
+ /***/ (function(module, exports, __webpack_require__) {
3221
3326
 
3222
3327
  "use strict";
3223
3328
  var __extends = (this && this.__extends) || function (d, b) {
@@ -3225,7 +3330,7 @@ return /******/ (function(modules) { // webpackBootstrap
3225
3330
  function __() { this.constructor = d; }
3226
3331
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3227
3332
  };
3228
- var dispatcher_1 = __webpack_require__(23);
3333
+ var dispatcher_1 = __webpack_require__(24);
3229
3334
  var timers_1 = __webpack_require__(12);
3230
3335
  var logger_1 = __webpack_require__(8);
3231
3336
  var Collections = __webpack_require__(9);
@@ -3389,7 +3494,7 @@ return /******/ (function(modules) { // webpackBootstrap
3389
3494
  ConnectionManager.prototype.resetActivityCheck = function () {
3390
3495
  var _this = this;
3391
3496
  this.stopActivityCheck();
3392
- if (!this.connection.handlesActivityChecks()) {
3497
+ if (this.connection && !this.connection.handlesActivityChecks()) {
3393
3498
  this.activityTimer = new timers_1.OneOffTimer(this.activityTimeout, function () {
3394
3499
  _this.sendActivityCheck();
3395
3500
  });
@@ -3511,13 +3616,13 @@ return /******/ (function(modules) { // webpackBootstrap
3511
3616
  exports["default"] = ConnectionManager;
3512
3617
 
3513
3618
 
3514
- /***/ },
3515
- /* 54 */
3516
- /***/ function(module, exports, __webpack_require__) {
3619
+ /***/ }),
3620
+ /* 55 */
3621
+ /***/ (function(module, exports, __webpack_require__) {
3517
3622
 
3518
3623
  "use strict";
3519
3624
  var Collections = __webpack_require__(9);
3520
- var factory_1 = __webpack_require__(42);
3625
+ var factory_1 = __webpack_require__(43);
3521
3626
  var Channels = (function () {
3522
3627
  function Channels() {
3523
3628
  this.channels = {};
@@ -3561,14 +3666,14 @@ return /******/ (function(modules) { // webpackBootstrap
3561
3666
  }
3562
3667
 
3563
3668
 
3564
- /***/ },
3565
- /* 55 */
3566
- /***/ function(module, exports, __webpack_require__) {
3669
+ /***/ }),
3670
+ /* 56 */
3671
+ /***/ (function(module, exports, __webpack_require__) {
3567
3672
 
3568
3673
  "use strict";
3569
- var factory_1 = __webpack_require__(42);
3674
+ var factory_1 = __webpack_require__(43);
3570
3675
  var util_1 = __webpack_require__(11);
3571
- var Errors = __webpack_require__(30);
3676
+ var Errors = __webpack_require__(31);
3572
3677
  var Collections = __webpack_require__(9);
3573
3678
  var TransportStrategy = (function () {
3574
3679
  function TransportStrategy(name, priority, transport, options) {
@@ -3668,9 +3773,9 @@ return /******/ (function(modules) { // webpackBootstrap
3668
3773
  }
3669
3774
 
3670
3775
 
3671
- /***/ },
3672
- /* 56 */
3673
- /***/ function(module, exports, __webpack_require__) {
3776
+ /***/ }),
3777
+ /* 57 */
3778
+ /***/ (function(module, exports, __webpack_require__) {
3674
3779
 
3675
3780
  "use strict";
3676
3781
  var Collections = __webpack_require__(9);
@@ -3765,9 +3870,9 @@ return /******/ (function(modules) { // webpackBootstrap
3765
3870
  exports["default"] = SequentialStrategy;
3766
3871
 
3767
3872
 
3768
- /***/ },
3769
- /* 57 */
3770
- /***/ function(module, exports, __webpack_require__) {
3873
+ /***/ }),
3874
+ /* 58 */
3875
+ /***/ (function(module, exports, __webpack_require__) {
3771
3876
 
3772
3877
  "use strict";
3773
3878
  var Collections = __webpack_require__(9);
@@ -3828,14 +3933,14 @@ return /******/ (function(modules) { // webpackBootstrap
3828
3933
  }
3829
3934
 
3830
3935
 
3831
- /***/ },
3832
- /* 58 */
3833
- /***/ function(module, exports, __webpack_require__) {
3936
+ /***/ }),
3937
+ /* 59 */
3938
+ /***/ (function(module, exports, __webpack_require__) {
3834
3939
 
3835
3940
  "use strict";
3836
3941
  var util_1 = __webpack_require__(11);
3837
3942
  var runtime_1 = __webpack_require__(2);
3838
- var sequential_strategy_1 = __webpack_require__(56);
3943
+ var sequential_strategy_1 = __webpack_require__(57);
3839
3944
  var Collections = __webpack_require__(9);
3840
3945
  var CachedStrategy = (function () {
3841
3946
  function CachedStrategy(strategy, transports, options) {
@@ -3943,9 +4048,9 @@ return /******/ (function(modules) { // webpackBootstrap
3943
4048
  }
3944
4049
 
3945
4050
 
3946
- /***/ },
3947
- /* 59 */
3948
- /***/ function(module, exports, __webpack_require__) {
4051
+ /***/ }),
4052
+ /* 60 */
4053
+ /***/ (function(module, exports, __webpack_require__) {
3949
4054
 
3950
4055
  "use strict";
3951
4056
  var timers_1 = __webpack_require__(12);
@@ -3985,9 +4090,9 @@ return /******/ (function(modules) { // webpackBootstrap
3985
4090
  exports["default"] = DelayedStrategy;
3986
4091
 
3987
4092
 
3988
- /***/ },
3989
- /* 60 */
3990
- /***/ function(module, exports) {
4093
+ /***/ }),
4094
+ /* 61 */
4095
+ /***/ (function(module, exports) {
3991
4096
 
3992
4097
  "use strict";
3993
4098
  var IfStrategy = (function () {
@@ -4010,9 +4115,9 @@ return /******/ (function(modules) { // webpackBootstrap
4010
4115
  exports["default"] = IfStrategy;
4011
4116
 
4012
4117
 
4013
- /***/ },
4014
- /* 61 */
4015
- /***/ function(module, exports) {
4118
+ /***/ }),
4119
+ /* 62 */
4120
+ /***/ (function(module, exports) {
4016
4121
 
4017
4122
  "use strict";
4018
4123
  var FirstConnectedStrategy = (function () {
@@ -4037,9 +4142,9 @@ return /******/ (function(modules) { // webpackBootstrap
4037
4142
  exports["default"] = FirstConnectedStrategy;
4038
4143
 
4039
4144
 
4040
- /***/ },
4041
- /* 62 */
4042
- /***/ function(module, exports, __webpack_require__) {
4145
+ /***/ }),
4146
+ /* 63 */
4147
+ /***/ (function(module, exports, __webpack_require__) {
4043
4148
 
4044
4149
  "use strict";
4045
4150
  var defaults_1 = __webpack_require__(5);
@@ -4068,6 +4173,7 @@ return /******/ (function(modules) { // webpackBootstrap
4068
4173
  };
4069
4174
 
4070
4175
 
4071
- /***/ }
4176
+ /***/ })
4072
4177
  /******/ ])
4073
4178
  });
4179
+ ;