socket.io-rails 1.0.3 → 1.0.5

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: fe39cef77a14096970e6c264320fe5b475ca4b11
4
- data.tar.gz: 4da22ce362e7b65ef904f2aabddd1acd3dba5e8d
3
+ metadata.gz: aa3e436bf211e5063bbf2d958116b0b7fc89fd6b
4
+ data.tar.gz: 8d8ede182179bc03fdf972a238b2fcf1fcc25121
5
5
  SHA512:
6
- metadata.gz: 1038d77c97e3766feda511081e7f8718c75ef7a401c9fe3efd3b85c9361de187712a135b0e8e2fbd57abcc4b1ff4fc372fa9479ab31da590358b3b68045f24ac
7
- data.tar.gz: 5897bef70a90254ba85704da0987f1476f4253eaed18965f8c1de446d8816563caa3694ac1d30cf510ea6ff20abbbd989604f4ea95aebb5ffbf7768422d61230
6
+ metadata.gz: d6443dfd027388723895f665851b5b9757d550a0b4543d4d0215ad7ff35b5eb44cacd12c8cd01e983617d52adf927225a32942fdae32577fa3ca8283af7ed78e
7
+ data.tar.gz: 986e8942506544830789c62c4719cac3945a4dc086786fae3db5c9f5bcde4927bac753df1cb250b8c3a24647d9b6155e1becd7ad857991da54e96070184795be
@@ -1,5 +1,5 @@
1
1
  module Socketio
2
2
  module Rails
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
@@ -52,7 +52,7 @@ function lookup(uri, opts) {
52
52
  var id = parsed.id;
53
53
  var io;
54
54
 
55
- if (opts.forceNew || false === opts.multiplex) {
55
+ if (opts.forceNew || opts['force new connection'] || false === opts.multiplex) {
56
56
  debug('ignoring socket cache for %s', source);
57
57
  io = Manager(source, opts);
58
58
  } else {
@@ -92,7 +92,7 @@ exports.connect = lookup;
92
92
  exports.Manager = require('./manager');
93
93
  exports.Socket = require('./socket');
94
94
 
95
- },{"./manager":3,"./socket":5,"./url":6,"debug":8,"socket.io-parser":39}],3:[function(require,module,exports){
95
+ },{"./manager":3,"./socket":5,"./url":6,"debug":9,"socket.io-parser":40}],3:[function(require,module,exports){
96
96
 
97
97
  /**
98
98
  * Module dependencies.
@@ -101,10 +101,10 @@ exports.Socket = require('./socket');
101
101
  var url = require('./url');
102
102
  var eio = require('engine.io-client');
103
103
  var Socket = require('./socket');
104
- var Emitter = require('emitter');
104
+ var Emitter = require('component-emitter');
105
105
  var parser = require('socket.io-parser');
106
106
  var on = require('./on');
107
- var bind = require('bind');
107
+ var bind = require('component-bind');
108
108
  var object = require('object-component');
109
109
  var debug = require('debug')('socket.io-client:manager');
110
110
 
@@ -124,7 +124,7 @@ module.exports = Manager;
124
124
 
125
125
  function Manager(uri, opts){
126
126
  if (!(this instanceof Manager)) return new Manager(uri, opts);
127
- if ('object' == typeof uri) {
127
+ if (uri && ('object' == typeof uri)) {
128
128
  opts = uri;
129
129
  uri = undefined;
130
130
  }
@@ -150,6 +150,19 @@ function Manager(uri, opts){
150
150
  this.open();
151
151
  }
152
152
 
153
+ /**
154
+ * Propagate given event to sockets and emit on `this`
155
+ *
156
+ * @api private
157
+ */
158
+
159
+ Manager.prototype.emitAll = function() {
160
+ this.emit.apply(this, arguments);
161
+ for (var nsp in this.nsps) {
162
+ this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
163
+ }
164
+ };
165
+
153
166
  /**
154
167
  * Mix in `Emitter`.
155
168
  */
@@ -271,7 +284,7 @@ Manager.prototype.connect = function(fn){
271
284
  debug('connect_error');
272
285
  self.cleanup();
273
286
  self.readyState = 'closed';
274
- self.emit('connect_error', data);
287
+ self.emitAll('connect_error', data);
275
288
  if (fn) {
276
289
  var err = new Error('Connection error');
277
290
  err.data = data;
@@ -292,7 +305,7 @@ Manager.prototype.connect = function(fn){
292
305
  openSub.destroy();
293
306
  socket.close();
294
307
  socket.emit('error', 'timeout');
295
- self.emit('connect_timeout', timeout);
308
+ self.emitAll('connect_timeout', timeout);
296
309
  }, timeout);
297
310
 
298
311
  this.subs.push({
@@ -360,7 +373,7 @@ Manager.prototype.ondecoded = function(packet) {
360
373
 
361
374
  Manager.prototype.onerror = function(err){
362
375
  debug('error', err);
363
- this.emit('error', err);
376
+ this.emitAll('error', err);
364
377
  };
365
378
 
366
379
  /**
@@ -491,7 +504,7 @@ Manager.prototype.reconnect = function(){
491
504
 
492
505
  if (this.attempts > this._reconnectionAttempts) {
493
506
  debug('reconnect failed');
494
- this.emit('reconnect_failed');
507
+ this.emitAll('reconnect_failed');
495
508
  this.reconnecting = false;
496
509
  } else {
497
510
  var delay = this.attempts * this.reconnectionDelay();
@@ -501,13 +514,14 @@ Manager.prototype.reconnect = function(){
501
514
  this.reconnecting = true;
502
515
  var timer = setTimeout(function(){
503
516
  debug('attempting reconnect');
504
- self.emit('reconnect_attempt');
517
+ self.emitAll('reconnect_attempt');
518
+ self.emitAll('reconnecting', self.attempts);
505
519
  self.open(function(err){
506
520
  if (err) {
507
521
  debug('reconnect attempt error');
508
522
  self.reconnecting = false;
509
523
  self.reconnect();
510
- self.emit('reconnect_error', err.data);
524
+ self.emitAll('reconnect_error', err.data);
511
525
  } else {
512
526
  debug('reconnect success');
513
527
  self.onreconnect();
@@ -533,10 +547,10 @@ Manager.prototype.onreconnect = function(){
533
547
  var attempt = this.attempts;
534
548
  this.attempts = 0;
535
549
  this.reconnecting = false;
536
- this.emit('reconnect', attempt);
550
+ this.emitAll('reconnect', attempt);
537
551
  };
538
552
 
539
- },{"./on":4,"./socket":5,"./url":6,"bind":7,"debug":8,"emitter":9,"engine.io-client":10,"object-component":36,"socket.io-parser":39}],4:[function(require,module,exports){
553
+ },{"./on":4,"./socket":5,"./url":6,"component-bind":7,"component-emitter":8,"debug":9,"engine.io-client":11,"object-component":37,"socket.io-parser":40}],4:[function(require,module,exports){
540
554
 
541
555
  /**
542
556
  * Module exports.
@@ -569,10 +583,10 @@ function on(obj, ev, fn) {
569
583
  */
570
584
 
571
585
  var parser = require('socket.io-parser');
572
- var Emitter = require('emitter');
586
+ var Emitter = require('component-emitter');
573
587
  var toArray = require('to-array');
574
588
  var on = require('./on');
575
- var bind = require('bind');
589
+ var bind = require('component-bind');
576
590
  var debug = require('debug')('socket.io-client:socket');
577
591
  var hasBin = require('has-binary-data');
578
592
  var indexOf = require('indexof');
@@ -592,8 +606,15 @@ module.exports = exports = Socket;
592
606
 
593
607
  var events = {
594
608
  connect: 1,
609
+ connect_error: 1,
610
+ connect_timeout: 1,
595
611
  disconnect: 1,
596
- error: 1
612
+ error: 1,
613
+ reconnect: 1,
614
+ reconnect_attempt: 1,
615
+ reconnect_failed: 1,
616
+ reconnect_error: 1,
617
+ reconnecting: 1
597
618
  };
598
619
 
599
620
  /**
@@ -615,7 +636,8 @@ function Socket(io, nsp){
615
636
  this.ids = 0;
616
637
  this.acks = {};
617
638
  this.open();
618
- this.buffer = [];
639
+ this.receiveBuffer = [];
640
+ this.sendBuffer = [];
619
641
  this.connected = false;
620
642
  this.disconnected = true;
621
643
  }
@@ -639,7 +661,6 @@ Socket.prototype.connect = function(){
639
661
  io.open(); // ensure open
640
662
  this.subs = [
641
663
  on(io, 'open', bind(this, 'onopen')),
642
- on(io, 'error', bind(this, 'onerror')),
643
664
  on(io, 'packet', bind(this, 'onpacket')),
644
665
  on(io, 'close', bind(this, 'onclose'))
645
666
  ];
@@ -688,7 +709,11 @@ Socket.prototype.emit = function(ev){
688
709
  packet.id = this.ids++;
689
710
  }
690
711
 
691
- this.packet(packet);
712
+ if (this.connected) {
713
+ this.packet(packet);
714
+ } else {
715
+ this.sendBuffer.push(packet);
716
+ }
692
717
 
693
718
  return this;
694
719
  };
@@ -705,17 +730,6 @@ Socket.prototype.packet = function(packet){
705
730
  this.io.packet(packet);
706
731
  };
707
732
 
708
- /**
709
- * Called upon `error`.
710
- *
711
- * @param {Object} data
712
- * @api private
713
- */
714
-
715
- Socket.prototype.onerror = function(data){
716
- this.emit('error', data);
717
- };
718
-
719
733
  /**
720
734
  * "Opens" the socket.
721
735
  *
@@ -805,7 +819,7 @@ Socket.prototype.onevent = function(packet){
805
819
  if (this.connected) {
806
820
  emit.apply(this, args);
807
821
  } else {
808
- this.buffer.push(args);
822
+ this.receiveBuffer.push(args);
809
823
  }
810
824
  };
811
825
 
@@ -862,16 +876,22 @@ Socket.prototype.onconnect = function(){
862
876
  };
863
877
 
864
878
  /**
865
- * Emit buffered events.
879
+ * Emit buffered events (received and emitted).
866
880
  *
867
881
  * @api private
868
882
  */
869
883
 
870
884
  Socket.prototype.emitBuffered = function(){
871
- for (var i = 0; i < this.buffer.length; i++) {
872
- emit.apply(this, this.buffer[i]);
885
+ var i;
886
+ for (i = 0; i < this.receiveBuffer.length; i++) {
887
+ emit.apply(this, this.receiveBuffer[i]);
888
+ }
889
+ this.receiveBuffer = [];
890
+
891
+ for (i = 0; i < this.sendBuffer.length; i++) {
892
+ this.packet(this.sendBuffer[i]);
873
893
  }
874
- this.buffer = [];
894
+ this.sendBuffer = [];
875
895
  };
876
896
 
877
897
  /**
@@ -925,7 +945,7 @@ Socket.prototype.disconnect = function(){
925
945
  return this;
926
946
  };
927
947
 
928
- },{"./on":4,"bind":7,"debug":8,"emitter":9,"has-binary-data":31,"indexof":35,"socket.io-parser":39,"to-array":42}],6:[function(require,module,exports){
948
+ },{"./on":4,"component-bind":7,"component-emitter":8,"debug":9,"has-binary-data":32,"indexof":36,"socket.io-parser":40,"to-array":43}],6:[function(require,module,exports){
929
949
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
930
950
  /**
931
951
  * Module dependencies.
@@ -979,24 +999,26 @@ function url(uri, loc){
979
999
  }
980
1000
 
981
1001
  // make sure we treat `localhost:80` and `localhost` equally
982
- if ((/(http|ws)/.test(obj.protocol) && 80 == obj.port) ||
983
- (/(http|ws)s/.test(obj.protocol) && 443 == obj.port)) {
984
- delete obj.port;
1002
+ if (!obj.port) {
1003
+ if (/^(http|ws)$/.test(obj.protocol)) {
1004
+ obj.port = '80';
1005
+ }
1006
+ else if (/^(http|ws)s$/.test(obj.protocol)) {
1007
+ obj.port = '443';
1008
+ }
985
1009
  }
986
1010
 
987
1011
  obj.path = obj.path || '/';
988
1012
 
989
1013
  // define unique id
990
- obj.id = obj.protocol + obj.host + (obj.port ? (':' + obj.port) : '');
991
-
1014
+ obj.id = obj.protocol + '://' + obj.host + ':' + obj.port;
992
1015
  // define href
993
- obj.href = obj.protocol + '://' + obj.host + (obj.port ? (':' + obj.port) : '');
1016
+ obj.href = obj.protocol + '://' + obj.host + (loc && loc.port == obj.port ? '' : (':' + obj.port));
994
1017
 
995
1018
  return obj;
996
1019
  }
997
1020
 
998
- },{"debug":8,"parseuri":37}],7:[function(require,module,exports){
999
-
1021
+ },{"debug":9,"parseuri":38}],7:[function(require,module,exports){
1000
1022
  /**
1001
1023
  * Slice reference.
1002
1024
  */
@@ -1015,7 +1037,7 @@ var slice = [].slice;
1015
1037
  module.exports = function(obj, fn){
1016
1038
  if ('string' == typeof fn) fn = obj[fn];
1017
1039
  if ('function' != typeof fn) throw new Error('bind() requires a function');
1018
- var args = [].slice.call(arguments, 2);
1040
+ var args = slice.call(arguments, 2);
1019
1041
  return function(){
1020
1042
  return fn.apply(obj, args.concat(slice.call(arguments)));
1021
1043
  }
@@ -1023,6 +1045,172 @@ module.exports = function(obj, fn){
1023
1045
 
1024
1046
  },{}],8:[function(require,module,exports){
1025
1047
 
1048
+ /**
1049
+ * Expose `Emitter`.
1050
+ */
1051
+
1052
+ module.exports = Emitter;
1053
+
1054
+ /**
1055
+ * Initialize a new `Emitter`.
1056
+ *
1057
+ * @api public
1058
+ */
1059
+
1060
+ function Emitter(obj) {
1061
+ if (obj) return mixin(obj);
1062
+ };
1063
+
1064
+ /**
1065
+ * Mixin the emitter properties.
1066
+ *
1067
+ * @param {Object} obj
1068
+ * @return {Object}
1069
+ * @api private
1070
+ */
1071
+
1072
+ function mixin(obj) {
1073
+ for (var key in Emitter.prototype) {
1074
+ obj[key] = Emitter.prototype[key];
1075
+ }
1076
+ return obj;
1077
+ }
1078
+
1079
+ /**
1080
+ * Listen on the given `event` with `fn`.
1081
+ *
1082
+ * @param {String} event
1083
+ * @param {Function} fn
1084
+ * @return {Emitter}
1085
+ * @api public
1086
+ */
1087
+
1088
+ Emitter.prototype.on =
1089
+ Emitter.prototype.addEventListener = function(event, fn){
1090
+ this._callbacks = this._callbacks || {};
1091
+ (this._callbacks[event] = this._callbacks[event] || [])
1092
+ .push(fn);
1093
+ return this;
1094
+ };
1095
+
1096
+ /**
1097
+ * Adds an `event` listener that will be invoked a single
1098
+ * time then automatically removed.
1099
+ *
1100
+ * @param {String} event
1101
+ * @param {Function} fn
1102
+ * @return {Emitter}
1103
+ * @api public
1104
+ */
1105
+
1106
+ Emitter.prototype.once = function(event, fn){
1107
+ var self = this;
1108
+ this._callbacks = this._callbacks || {};
1109
+
1110
+ function on() {
1111
+ self.off(event, on);
1112
+ fn.apply(this, arguments);
1113
+ }
1114
+
1115
+ on.fn = fn;
1116
+ this.on(event, on);
1117
+ return this;
1118
+ };
1119
+
1120
+ /**
1121
+ * Remove the given callback for `event` or all
1122
+ * registered callbacks.
1123
+ *
1124
+ * @param {String} event
1125
+ * @param {Function} fn
1126
+ * @return {Emitter}
1127
+ * @api public
1128
+ */
1129
+
1130
+ Emitter.prototype.off =
1131
+ Emitter.prototype.removeListener =
1132
+ Emitter.prototype.removeAllListeners =
1133
+ Emitter.prototype.removeEventListener = function(event, fn){
1134
+ this._callbacks = this._callbacks || {};
1135
+
1136
+ // all
1137
+ if (0 == arguments.length) {
1138
+ this._callbacks = {};
1139
+ return this;
1140
+ }
1141
+
1142
+ // specific event
1143
+ var callbacks = this._callbacks[event];
1144
+ if (!callbacks) return this;
1145
+
1146
+ // remove all handlers
1147
+ if (1 == arguments.length) {
1148
+ delete this._callbacks[event];
1149
+ return this;
1150
+ }
1151
+
1152
+ // remove specific handler
1153
+ var cb;
1154
+ for (var i = 0; i < callbacks.length; i++) {
1155
+ cb = callbacks[i];
1156
+ if (cb === fn || cb.fn === fn) {
1157
+ callbacks.splice(i, 1);
1158
+ break;
1159
+ }
1160
+ }
1161
+ return this;
1162
+ };
1163
+
1164
+ /**
1165
+ * Emit `event` with the given args.
1166
+ *
1167
+ * @param {String} event
1168
+ * @param {Mixed} ...
1169
+ * @return {Emitter}
1170
+ */
1171
+
1172
+ Emitter.prototype.emit = function(event){
1173
+ this._callbacks = this._callbacks || {};
1174
+ var args = [].slice.call(arguments, 1)
1175
+ , callbacks = this._callbacks[event];
1176
+
1177
+ if (callbacks) {
1178
+ callbacks = callbacks.slice(0);
1179
+ for (var i = 0, len = callbacks.length; i < len; ++i) {
1180
+ callbacks[i].apply(this, args);
1181
+ }
1182
+ }
1183
+
1184
+ return this;
1185
+ };
1186
+
1187
+ /**
1188
+ * Return array of callbacks for `event`.
1189
+ *
1190
+ * @param {String} event
1191
+ * @return {Array}
1192
+ * @api public
1193
+ */
1194
+
1195
+ Emitter.prototype.listeners = function(event){
1196
+ this._callbacks = this._callbacks || {};
1197
+ return this._callbacks[event] || [];
1198
+ };
1199
+
1200
+ /**
1201
+ * Check if this emitter has `event` handlers.
1202
+ *
1203
+ * @param {String} event
1204
+ * @return {Boolean}
1205
+ * @api public
1206
+ */
1207
+
1208
+ Emitter.prototype.hasListeners = function(event){
1209
+ return !! this.listeners(event).length;
1210
+ };
1211
+
1212
+ },{}],9:[function(require,module,exports){
1213
+
1026
1214
  /**
1027
1215
  * Expose `debug()` as the module.
1028
1216
  */
@@ -1160,7 +1348,7 @@ try {
1160
1348
  if (window.localStorage) debug.enable(localStorage.debug);
1161
1349
  } catch(e){}
1162
1350
 
1163
- },{}],9:[function(require,module,exports){
1351
+ },{}],10:[function(require,module,exports){
1164
1352
 
1165
1353
  /**
1166
1354
  * Module dependencies.
@@ -1324,11 +1512,11 @@ Emitter.prototype.hasListeners = function(event){
1324
1512
  return !! this.listeners(event).length;
1325
1513
  };
1326
1514
 
1327
- },{"indexof":35}],10:[function(require,module,exports){
1515
+ },{"indexof":36}],11:[function(require,module,exports){
1328
1516
 
1329
1517
  module.exports = require('./lib/');
1330
1518
 
1331
- },{"./lib/":11}],11:[function(require,module,exports){
1519
+ },{"./lib/":12}],12:[function(require,module,exports){
1332
1520
 
1333
1521
  module.exports = require('./socket');
1334
1522
 
@@ -1340,13 +1528,13 @@ module.exports = require('./socket');
1340
1528
  */
1341
1529
  module.exports.parser = require('engine.io-parser');
1342
1530
 
1343
- },{"./socket":12,"engine.io-parser":20}],12:[function(require,module,exports){
1531
+ },{"./socket":13,"engine.io-parser":22}],13:[function(require,module,exports){
1344
1532
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
1345
1533
  * Module dependencies.
1346
1534
  */
1347
1535
 
1348
1536
  var transports = require('./transports');
1349
- var Emitter = require('emitter');
1537
+ var Emitter = require('component-emitter');
1350
1538
  var debug = require('debug')('engine.io-client:socket');
1351
1539
  var index = require('indexof');
1352
1540
  var parser = require('engine.io-parser');
@@ -1969,13 +2157,13 @@ Socket.prototype.filterUpgrades = function (upgrades) {
1969
2157
  return filteredUpgrades;
1970
2158
  };
1971
2159
 
1972
- },{"./transport":13,"./transports":14,"debug":8,"emitter":9,"engine.io-parser":20,"indexof":35,"parsejson":28,"parseqs":29,"parseuri":37}],13:[function(require,module,exports){
2160
+ },{"./transport":14,"./transports":15,"component-emitter":8,"debug":9,"engine.io-parser":22,"indexof":36,"parsejson":29,"parseqs":30,"parseuri":38}],14:[function(require,module,exports){
1973
2161
  /**
1974
2162
  * Module dependencies.
1975
2163
  */
1976
2164
 
1977
2165
  var parser = require('engine.io-parser');
1978
- var Emitter = require('emitter');
2166
+ var Emitter = require('component-emitter');
1979
2167
 
1980
2168
  /**
1981
2169
  * Module exports.
@@ -2119,7 +2307,7 @@ Transport.prototype.onClose = function () {
2119
2307
  this.emit('close');
2120
2308
  };
2121
2309
 
2122
- },{"emitter":9,"engine.io-parser":20}],14:[function(require,module,exports){
2310
+ },{"component-emitter":8,"engine.io-parser":22}],15:[function(require,module,exports){
2123
2311
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
2124
2312
  * Module dependencies
2125
2313
  */
@@ -2169,14 +2357,14 @@ function polling(opts){
2169
2357
  }
2170
2358
  }
2171
2359
 
2172
- },{"./polling-jsonp":15,"./polling-xhr":16,"./websocket":18,"xmlhttprequest":19}],15:[function(require,module,exports){
2360
+ },{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,"xmlhttprequest":20}],16:[function(require,module,exports){
2173
2361
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
2174
2362
  /**
2175
2363
  * Module requirements.
2176
2364
  */
2177
2365
 
2178
2366
  var Polling = require('./polling');
2179
- var inherit = require('inherits');
2367
+ var inherit = require('component-inherit');
2180
2368
 
2181
2369
  /**
2182
2370
  * Module exports.
@@ -2403,16 +2591,16 @@ JSONPPolling.prototype.doWrite = function (data, fn) {
2403
2591
  }
2404
2592
  };
2405
2593
 
2406
- },{"./polling":17,"inherits":27}],16:[function(require,module,exports){
2594
+ },{"./polling":18,"component-inherit":21}],17:[function(require,module,exports){
2407
2595
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
2408
2596
  * Module requirements.
2409
2597
  */
2410
2598
 
2411
2599
  var XMLHttpRequest = require('xmlhttprequest');
2412
2600
  var Polling = require('./polling');
2413
- var Emitter = require('emitter');
2601
+ var Emitter = require('component-emitter');
2602
+ var inherit = require('component-inherit');
2414
2603
  var debug = require('debug')('engine.io-client:polling-xhr');
2415
- var inherit = require('inherits');
2416
2604
 
2417
2605
  /**
2418
2606
  * Module exports.
@@ -2715,7 +2903,7 @@ function unloadHandler() {
2715
2903
  }
2716
2904
  }
2717
2905
 
2718
- },{"./polling":17,"debug":8,"emitter":9,"inherits":27,"xmlhttprequest":19}],17:[function(require,module,exports){
2906
+ },{"./polling":18,"component-emitter":8,"component-inherit":21,"debug":9,"xmlhttprequest":20}],18:[function(require,module,exports){
2719
2907
  /**
2720
2908
  * Module dependencies.
2721
2909
  */
@@ -2723,8 +2911,8 @@ function unloadHandler() {
2723
2911
  var Transport = require('../transport');
2724
2912
  var parseqs = require('parseqs');
2725
2913
  var parser = require('engine.io-parser');
2914
+ var inherit = require('component-inherit');
2726
2915
  var debug = require('debug')('engine.io-client:polling');
2727
- var inherit = require('inherits');
2728
2916
 
2729
2917
  /**
2730
2918
  * Module exports.
@@ -2962,7 +3150,7 @@ Polling.prototype.uri = function(){
2962
3150
  return schema + '://' + this.hostname + port + this.path + query;
2963
3151
  };
2964
3152
 
2965
- },{"../transport":13,"debug":8,"engine.io-parser":20,"inherits":27,"parseqs":29,"xmlhttprequest":19}],18:[function(require,module,exports){
3153
+ },{"../transport":14,"component-inherit":21,"debug":9,"engine.io-parser":22,"parseqs":30,"xmlhttprequest":20}],19:[function(require,module,exports){
2966
3154
  /**
2967
3155
  * Module dependencies.
2968
3156
  */
@@ -2970,8 +3158,8 @@ Polling.prototype.uri = function(){
2970
3158
  var Transport = require('../transport');
2971
3159
  var parser = require('engine.io-parser');
2972
3160
  var parseqs = require('parseqs');
3161
+ var inherit = require('component-inherit');
2973
3162
  var debug = require('debug')('engine.io-client:websocket');
2974
- var inherit = require('inherits');
2975
3163
 
2976
3164
  /**
2977
3165
  * `ws` exposes a WebSocket-compatible interface in
@@ -3193,7 +3381,7 @@ WS.prototype.check = function(){
3193
3381
  return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
3194
3382
  };
3195
3383
 
3196
- },{"../transport":13,"debug":8,"engine.io-parser":20,"inherits":27,"parseqs":29,"ws":30}],19:[function(require,module,exports){
3384
+ },{"../transport":14,"component-inherit":21,"debug":9,"engine.io-parser":22,"parseqs":30,"ws":31}],20:[function(require,module,exports){
3197
3385
  // browser shim for xmlhttprequest module
3198
3386
  var hasCORS = require('has-cors');
3199
3387
 
@@ -3214,7 +3402,15 @@ module.exports = function(opts) {
3214
3402
  }
3215
3403
  }
3216
3404
 
3217
- },{"has-cors":33}],20:[function(require,module,exports){
3405
+ },{"has-cors":34}],21:[function(require,module,exports){
3406
+
3407
+ module.exports = function(a, b){
3408
+ var fn = function(){};
3409
+ fn.prototype = b.prototype;
3410
+ a.prototype = new fn;
3411
+ a.prototype.constructor = a;
3412
+ };
3413
+ },{}],22:[function(require,module,exports){
3218
3414
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
3219
3415
  * Module dependencies.
3220
3416
  */
@@ -3759,7 +3955,7 @@ exports.decodePayloadAsBinary = function (data, binaryType, callback) {
3759
3955
  });
3760
3956
  };
3761
3957
 
3762
- },{"./keys":21,"after":22,"arraybuffer.slice":23,"base64-arraybuffer":24,"blob":25,"utf8":26}],21:[function(require,module,exports){
3958
+ },{"./keys":23,"after":24,"arraybuffer.slice":25,"base64-arraybuffer":26,"blob":27,"utf8":28}],23:[function(require,module,exports){
3763
3959
 
3764
3960
  /**
3765
3961
  * Gets the keys for an object.
@@ -3780,7 +3976,7 @@ module.exports = Object.keys || function keys (obj){
3780
3976
  return arr;
3781
3977
  };
3782
3978
 
3783
- },{}],22:[function(require,module,exports){
3979
+ },{}],24:[function(require,module,exports){
3784
3980
  module.exports = after
3785
3981
 
3786
3982
  function after(count, callback, err_cb) {
@@ -3810,7 +4006,7 @@ function after(count, callback, err_cb) {
3810
4006
 
3811
4007
  function noop() {}
3812
4008
 
3813
- },{}],23:[function(require,module,exports){
4009
+ },{}],25:[function(require,module,exports){
3814
4010
  /**
3815
4011
  * An abstraction for slicing an arraybuffer even when
3816
4012
  * ArrayBuffer.prototype.slice is not supported
@@ -3841,7 +4037,7 @@ module.exports = function(arraybuffer, start, end) {
3841
4037
  return result.buffer;
3842
4038
  };
3843
4039
 
3844
- },{}],24:[function(require,module,exports){
4040
+ },{}],26:[function(require,module,exports){
3845
4041
  /*
3846
4042
  * base64-arraybuffer
3847
4043
  * https://github.com/niklasvh/base64-arraybuffer
@@ -3902,7 +4098,7 @@ module.exports = function(arraybuffer, start, end) {
3902
4098
  };
3903
4099
  })("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
3904
4100
 
3905
- },{}],25:[function(require,module,exports){
4101
+ },{}],27:[function(require,module,exports){
3906
4102
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
3907
4103
  * Create a blob builder even when vendor prefixes exist
3908
4104
  */
@@ -3953,7 +4149,7 @@ module.exports = (function() {
3953
4149
  }
3954
4150
  })();
3955
4151
 
3956
- },{}],26:[function(require,module,exports){
4152
+ },{}],28:[function(require,module,exports){
3957
4153
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/*! http://mths.be/utf8js v2.0.0 by @mathias */
3958
4154
  ;(function(root) {
3959
4155
 
@@ -4194,32 +4390,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ?
4194
4390
 
4195
4391
  }(this));
4196
4392
 
4197
- },{}],27:[function(require,module,exports){
4198
- if (typeof Object.create === 'function') {
4199
- // implementation from standard node.js 'util' module
4200
- module.exports = function inherits(ctor, superCtor) {
4201
- ctor.super_ = superCtor
4202
- ctor.prototype = Object.create(superCtor.prototype, {
4203
- constructor: {
4204
- value: ctor,
4205
- enumerable: false,
4206
- writable: true,
4207
- configurable: true
4208
- }
4209
- });
4210
- };
4211
- } else {
4212
- // old school shim for old browsers
4213
- module.exports = function inherits(ctor, superCtor) {
4214
- ctor.super_ = superCtor
4215
- var TempCtor = function () {}
4216
- TempCtor.prototype = superCtor.prototype
4217
- ctor.prototype = new TempCtor()
4218
- ctor.prototype.constructor = ctor
4219
- }
4220
- }
4221
-
4222
- },{}],28:[function(require,module,exports){
4393
+ },{}],29:[function(require,module,exports){
4223
4394
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
4224
4395
  * JSON parse.
4225
4396
  *
@@ -4252,7 +4423,7 @@ module.exports = function parsejson(data) {
4252
4423
  return (new Function('return ' + data))();
4253
4424
  }
4254
4425
  };
4255
- },{}],29:[function(require,module,exports){
4426
+ },{}],30:[function(require,module,exports){
4256
4427
  /**
4257
4428
  * Compiles a querystring
4258
4429
  * Returns string representation of the object
@@ -4291,7 +4462,7 @@ exports.decode = function(qs){
4291
4462
  return qry;
4292
4463
  };
4293
4464
 
4294
- },{}],30:[function(require,module,exports){
4465
+ },{}],31:[function(require,module,exports){
4295
4466
 
4296
4467
  /**
4297
4468
  * Module dependencies.
@@ -4336,7 +4507,7 @@ function ws(uri, protocols, opts) {
4336
4507
 
4337
4508
  if (WebSocket) ws.prototype = WebSocket.prototype;
4338
4509
 
4339
- },{}],31:[function(require,module,exports){
4510
+ },{}],32:[function(require,module,exports){
4340
4511
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/*
4341
4512
  * Module requirements.
4342
4513
  */
@@ -4395,12 +4566,12 @@ function hasBinary(data) {
4395
4566
  return recursiveCheckForBinary(data);
4396
4567
  }
4397
4568
 
4398
- },{"isarray":32}],32:[function(require,module,exports){
4569
+ },{"isarray":33}],33:[function(require,module,exports){
4399
4570
  module.exports = Array.isArray || function (arr) {
4400
4571
  return Object.prototype.toString.call(arr) == '[object Array]';
4401
4572
  };
4402
4573
 
4403
- },{}],33:[function(require,module,exports){
4574
+ },{}],34:[function(require,module,exports){
4404
4575
 
4405
4576
  /**
4406
4577
  * Module dependencies.
@@ -4425,7 +4596,7 @@ try {
4425
4596
  module.exports = false;
4426
4597
  }
4427
4598
 
4428
- },{"global":34}],34:[function(require,module,exports){
4599
+ },{"global":35}],35:[function(require,module,exports){
4429
4600
 
4430
4601
  /**
4431
4602
  * Returns `this`. Execute this without a "context" (i.e. without it being
@@ -4435,7 +4606,7 @@ try {
4435
4606
 
4436
4607
  module.exports = (function () { return this; })();
4437
4608
 
4438
- },{}],35:[function(require,module,exports){
4609
+ },{}],36:[function(require,module,exports){
4439
4610
 
4440
4611
  var indexOf = [].indexOf;
4441
4612
 
@@ -4446,7 +4617,7 @@ module.exports = function(arr, obj){
4446
4617
  }
4447
4618
  return -1;
4448
4619
  };
4449
- },{}],36:[function(require,module,exports){
4620
+ },{}],37:[function(require,module,exports){
4450
4621
 
4451
4622
  /**
4452
4623
  * HOP ref.
@@ -4531,7 +4702,7 @@ exports.length = function(obj){
4531
4702
  exports.isEmpty = function(obj){
4532
4703
  return 0 == exports.length(obj);
4533
4704
  };
4534
- },{}],37:[function(require,module,exports){
4705
+ },{}],38:[function(require,module,exports){
4535
4706
  /**
4536
4707
  * Parses an URI
4537
4708
  *
@@ -4558,7 +4729,7 @@ module.exports = function parseuri(str) {
4558
4729
  return uri;
4559
4730
  };
4560
4731
 
4561
- },{}],38:[function(require,module,exports){
4732
+ },{}],39:[function(require,module,exports){
4562
4733
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
4563
4734
  * Modle requirements
4564
4735
  */
@@ -4712,7 +4883,7 @@ function isBuf(obj) {
4712
4883
  (global.ArrayBuffer && obj instanceof ArrayBuffer);
4713
4884
  }
4714
4885
 
4715
- },{"isarray":40}],39:[function(require,module,exports){
4886
+ },{"isarray":41}],40:[function(require,module,exports){
4716
4887
  var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
4717
4888
  /**
4718
4889
  * Module dependencies.
@@ -5098,9 +5269,9 @@ function error(data){
5098
5269
  };
5099
5270
  }
5100
5271
 
5101
- },{"./binary":38,"debug":8,"emitter":9,"isarray":40,"json3":41}],40:[function(require,module,exports){
5102
- module.exports=require(32)
5103
- },{}],41:[function(require,module,exports){
5272
+ },{"./binary":39,"debug":9,"emitter":10,"isarray":41,"json3":42}],41:[function(require,module,exports){
5273
+ module.exports=require(33)
5274
+ },{}],42:[function(require,module,exports){
5104
5275
  /*! JSON v3.2.6 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */
5105
5276
  ;(function (window) {
5106
5277
  // Convenience aliases.
@@ -5963,7 +6134,7 @@ module.exports=require(32)
5963
6134
  }
5964
6135
  }(this));
5965
6136
 
5966
- },{}],42:[function(require,module,exports){
6137
+ },{}],43:[function(require,module,exports){
5967
6138
  module.exports = toArray
5968
6139
 
5969
6140
  function toArray(list, index) {
@@ -5981,4 +6152,4 @@ function toArray(list, index) {
5981
6152
  },{}]},{},[1])
5982
6153
  (1)
5983
6154
  });
5984
- ;
6155
+ ;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socket.io-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2014-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties