socket.io-rails 1.3.1 → 1.3.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1998610d60fbb5076aaf09e0bf09de9b7f59b32
4
- data.tar.gz: f0ba1cb7900d14a5616db79a800c8b48f8d0db13
3
+ metadata.gz: f8ffd31c42f8991d6275a8fc6a2d366cd33af996
4
+ data.tar.gz: b62f3d430a23179d4f84411536c6bc3153a368c1
5
5
  SHA512:
6
- metadata.gz: 264e7eab0585b0165e9ff57f62aac8c592098ef083519d102b713a8868e30ad2d6e6e6b0b3dac7e71aea1a397ceb3c60100af6ff0dc83efe87850dcce17dcea5
7
- data.tar.gz: 6d4892b2d722e1f0eeeac26a5f9a57327aef30b0ec8c607ba2a49a3acf8d8d43846c71227827ce3ed5c75c2e578cf8d228c322feeff44fbec4fa585a824f0c75
6
+ metadata.gz: eadba0636c6628fc9909119de61366c015c88e05c2d5b8f57860ca8027aceae2e0b0d489c032961d8a268999ac20a91b9367391d539c776b7e39f4e205cb02a6
7
+ data.tar.gz: bdb9ea2d8e8fe9bddfc83339e8dfef4875300bb8280bb5592c51dc42a3a2404813fb960c869e3b80282e2683a031bcad075f890b6bfb20317913cf4ca9be447b
@@ -1,5 +1,5 @@
1
1
  module Socketio
2
2
  module Rails
3
- VERSION = "1.3.1"
3
+ VERSION = "1.3.3"
4
4
  end
5
5
  end
@@ -91,7 +91,7 @@ exports.connect = lookup;
91
91
  exports.Manager = _dereq_('./manager');
92
92
  exports.Socket = _dereq_('./socket');
93
93
 
94
- },{"./manager":3,"./socket":5,"./url":6,"debug":10,"socket.io-parser":44}],3:[function(_dereq_,module,exports){
94
+ },{"./manager":3,"./socket":5,"./url":6,"debug":10,"socket.io-parser":46}],3:[function(_dereq_,module,exports){
95
95
 
96
96
  /**
97
97
  * Module dependencies.
@@ -596,7 +596,7 @@ Manager.prototype.onreconnect = function(){
596
596
  this.emitAll('reconnect', attempt);
597
597
  };
598
598
 
599
- },{"./on":4,"./socket":5,"./url":6,"backo2":7,"component-bind":8,"component-emitter":9,"debug":10,"engine.io-client":11,"indexof":40,"object-component":41,"socket.io-parser":44}],4:[function(_dereq_,module,exports){
599
+ },{"./on":4,"./socket":5,"./url":6,"backo2":7,"component-bind":8,"component-emitter":9,"debug":10,"engine.io-client":11,"indexof":42,"object-component":43,"socket.io-parser":46}],4:[function(_dereq_,module,exports){
600
600
 
601
601
  /**
602
602
  * Module exports.
@@ -1009,7 +1009,7 @@ Socket.prototype.disconnect = function(){
1009
1009
  return this;
1010
1010
  };
1011
1011
 
1012
- },{"./on":4,"component-bind":8,"component-emitter":9,"debug":10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(_dereq_,module,exports){
1012
+ },{"./on":4,"component-bind":8,"component-emitter":9,"debug":10,"has-binary":38,"socket.io-parser":46,"to-array":50}],6:[function(_dereq_,module,exports){
1013
1013
  (function (global){
1014
1014
 
1015
1015
  /**
@@ -1086,7 +1086,7 @@ function url(uri, loc){
1086
1086
  }
1087
1087
 
1088
1088
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1089
- },{"debug":10,"parseuri":42}],7:[function(_dereq_,module,exports){
1089
+ },{"debug":10,"parseuri":44}],7:[function(_dereq_,module,exports){
1090
1090
 
1091
1091
  /**
1092
1092
  * Expose `Backoff`.
@@ -1580,7 +1580,12 @@ function Socket(uri, opts){
1580
1580
  if (opts.host) {
1581
1581
  var pieces = opts.host.split(':');
1582
1582
  opts.hostname = pieces.shift();
1583
- if (pieces.length) opts.port = pieces.pop();
1583
+ if (pieces.length) {
1584
+ opts.port = pieces.pop();
1585
+ } else if (!opts.port) {
1586
+ // if no port is specified manually, use the protocol default
1587
+ opts.port = this.secure ? '443' : '80';
1588
+ }
1584
1589
  }
1585
1590
 
1586
1591
  this.agent = opts.agent || false;
@@ -1605,9 +1610,20 @@ function Socket(uri, opts){
1605
1610
  this.callbackBuffer = [];
1606
1611
  this.policyPort = opts.policyPort || 843;
1607
1612
  this.rememberUpgrade = opts.rememberUpgrade || false;
1608
- this.open();
1609
1613
  this.binaryType = null;
1610
1614
  this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
1615
+ this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || true) : false;
1616
+
1617
+ // SSL options for Node.js client
1618
+ this.pfx = opts.pfx || null;
1619
+ this.key = opts.key || null;
1620
+ this.passphrase = opts.passphrase || null;
1621
+ this.cert = opts.cert || null;
1622
+ this.ca = opts.ca || null;
1623
+ this.ciphers = opts.ciphers || null;
1624
+ this.rejectUnauthorized = opts.rejectUnauthorized || null;
1625
+
1626
+ this.open();
1611
1627
  }
1612
1628
 
1613
1629
  Socket.priorWebsocketSuccess = false;
@@ -1671,7 +1687,15 @@ Socket.prototype.createTransport = function (name) {
1671
1687
  timestampRequests: this.timestampRequests,
1672
1688
  timestampParam: this.timestampParam,
1673
1689
  policyPort: this.policyPort,
1674
- socket: this
1690
+ socket: this,
1691
+ pfx: this.pfx,
1692
+ key: this.key,
1693
+ passphrase: this.passphrase,
1694
+ cert: this.cert,
1695
+ ca: this.ca,
1696
+ ciphers: this.ciphers,
1697
+ rejectUnauthorized: this.rejectUnauthorized,
1698
+ perMessageDeflate: this.perMessageDeflate
1675
1699
  });
1676
1700
 
1677
1701
  return transport;
@@ -1779,7 +1803,7 @@ Socket.prototype.probe = function (name) {
1779
1803
  if (failed) return;
1780
1804
 
1781
1805
  debug('probe transport "%s" opened', name);
1782
- transport.send([{ type: 'ping', data: 'probe' }]);
1806
+ transport.send([{ type: 'ping', data: 'probe', options: { compress: true } }]);
1783
1807
  transport.once('packet', function (msg) {
1784
1808
  if (failed) return;
1785
1809
  if ('pong' == msg.type && 'probe' == msg.data) {
@@ -1798,7 +1822,7 @@ Socket.prototype.probe = function (name) {
1798
1822
  cleanup();
1799
1823
 
1800
1824
  self.setTransport(transport);
1801
- transport.send([{ type: 'upgrade' }]);
1825
+ transport.send([{ type: 'upgrade', options: { compress: true } }]);
1802
1826
  self.emit('upgrade', transport);
1803
1827
  transport = null;
1804
1828
  self.upgrading = false;
@@ -2054,13 +2078,14 @@ Socket.prototype.flush = function () {
2054
2078
  *
2055
2079
  * @param {String} message.
2056
2080
  * @param {Function} callback function.
2081
+ * @param {Object} options.
2057
2082
  * @return {Socket} for chaining.
2058
2083
  * @api public
2059
2084
  */
2060
2085
 
2061
2086
  Socket.prototype.write =
2062
- Socket.prototype.send = function (msg, fn) {
2063
- this.sendPacket('message', msg, fn);
2087
+ Socket.prototype.send = function (msg, options, fn) {
2088
+ this.sendPacket('message', msg, options, fn);
2064
2089
  return this;
2065
2090
  };
2066
2091
 
@@ -2069,16 +2094,29 @@ Socket.prototype.send = function (msg, fn) {
2069
2094
  *
2070
2095
  * @param {String} packet type.
2071
2096
  * @param {String} data.
2097
+ * @param {Object} options.
2072
2098
  * @param {Function} callback function.
2073
2099
  * @api private
2074
2100
  */
2075
2101
 
2076
- Socket.prototype.sendPacket = function (type, data, fn) {
2102
+ Socket.prototype.sendPacket = function (type, data, options, fn) {
2103
+ if ('function' == typeof options) {
2104
+ fn = options;
2105
+ options = null;
2106
+ }
2107
+
2077
2108
  if ('closing' == this.readyState || 'closed' == this.readyState) {
2078
2109
  return;
2079
2110
  }
2080
2111
 
2081
- var packet = { type: type, data: data };
2112
+ options = options || {};
2113
+ options.compress = false !== options.compress;
2114
+
2115
+ var packet = {
2116
+ type: type,
2117
+ data: data,
2118
+ options: options
2119
+ };
2082
2120
  this.emit('packetCreate', packet);
2083
2121
  this.writeBuffer.push(packet);
2084
2122
  this.callbackBuffer.push(fn);
@@ -2206,7 +2244,7 @@ Socket.prototype.filterUpgrades = function (upgrades) {
2206
2244
  };
2207
2245
 
2208
2246
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2209
- },{"./transport":14,"./transports":15,"component-emitter":9,"debug":22,"engine.io-parser":25,"indexof":40,"parsejson":32,"parseqs":33,"parseuri":34}],14:[function(_dereq_,module,exports){
2247
+ },{"./transport":14,"./transports":15,"component-emitter":9,"debug":22,"engine.io-parser":25,"indexof":42,"parsejson":34,"parseqs":35,"parseuri":36}],14:[function(_dereq_,module,exports){
2210
2248
  /**
2211
2249
  * Module dependencies.
2212
2250
  */
@@ -2239,6 +2277,15 @@ function Transport (opts) {
2239
2277
  this.agent = opts.agent || false;
2240
2278
  this.socket = opts.socket;
2241
2279
  this.enablesXDR = opts.enablesXDR;
2280
+
2281
+ // SSL options for Node.js client
2282
+ this.pfx = opts.pfx;
2283
+ this.key = opts.key;
2284
+ this.passphrase = opts.passphrase;
2285
+ this.cert = opts.cert;
2286
+ this.ca = opts.ca;
2287
+ this.ciphers = opts.ciphers;
2288
+ this.rejectUnauthorized = opts.rejectUnauthorized;
2242
2289
  }
2243
2290
 
2244
2291
  /**
@@ -2729,6 +2776,16 @@ XHR.prototype.request = function(opts){
2729
2776
  opts.agent = this.agent || false;
2730
2777
  opts.supportsBinary = this.supportsBinary;
2731
2778
  opts.enablesXDR = this.enablesXDR;
2779
+
2780
+ // SSL options for Node.js client
2781
+ opts.pfx = this.pfx;
2782
+ opts.key = this.key;
2783
+ opts.passphrase = this.passphrase;
2784
+ opts.cert = this.cert;
2785
+ opts.ca = this.ca;
2786
+ opts.ciphers = this.ciphers;
2787
+ opts.rejectUnauthorized = this.rejectUnauthorized;
2788
+
2732
2789
  return new Request(opts);
2733
2790
  };
2734
2791
 
@@ -2788,6 +2845,16 @@ function Request(opts){
2788
2845
  this.isBinary = opts.isBinary;
2789
2846
  this.supportsBinary = opts.supportsBinary;
2790
2847
  this.enablesXDR = opts.enablesXDR;
2848
+
2849
+ // SSL options for Node.js client
2850
+ this.pfx = opts.pfx;
2851
+ this.key = opts.key;
2852
+ this.passphrase = opts.passphrase;
2853
+ this.cert = opts.cert;
2854
+ this.ca = opts.ca;
2855
+ this.ciphers = opts.ciphers;
2856
+ this.rejectUnauthorized = opts.rejectUnauthorized;
2857
+
2791
2858
  this.create();
2792
2859
  }
2793
2860
 
@@ -2804,7 +2871,18 @@ Emitter(Request.prototype);
2804
2871
  */
2805
2872
 
2806
2873
  Request.prototype.create = function(){
2807
- var xhr = this.xhr = new XMLHttpRequest({ agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR });
2874
+ var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
2875
+
2876
+ // SSL options for Node.js client
2877
+ opts.pfx = this.pfx;
2878
+ opts.key = this.key;
2879
+ opts.passphrase = this.passphrase;
2880
+ opts.cert = this.cert;
2881
+ opts.ca = this.ca;
2882
+ opts.ciphers = this.ciphers;
2883
+ opts.rejectUnauthorized = this.rejectUnauthorized;
2884
+
2885
+ var xhr = this.xhr = new XMLHttpRequest(opts);
2808
2886
  var self = this;
2809
2887
 
2810
2888
  try {
@@ -2901,7 +2979,7 @@ Request.prototype.onData = function(data){
2901
2979
 
2902
2980
  Request.prototype.onError = function(err){
2903
2981
  this.emit('error', err);
2904
- this.cleanup();
2982
+ this.cleanup(true);
2905
2983
  };
2906
2984
 
2907
2985
  /**
@@ -2910,7 +2988,7 @@ Request.prototype.onError = function(err){
2910
2988
  * @api private
2911
2989
  */
2912
2990
 
2913
- Request.prototype.cleanup = function(){
2991
+ Request.prototype.cleanup = function(fromError){
2914
2992
  if ('undefined' == typeof this.xhr || null === this.xhr) {
2915
2993
  return;
2916
2994
  }
@@ -2921,9 +2999,11 @@ Request.prototype.cleanup = function(){
2921
2999
  this.xhr.onreadystatechange = empty;
2922
3000
  }
2923
3001
 
2924
- try {
2925
- this.xhr.abort();
2926
- } catch(e) {}
3002
+ if (fromError) {
3003
+ try {
3004
+ this.xhr.abort();
3005
+ } catch(e) {}
3006
+ }
2927
3007
 
2928
3008
  if (global.document) {
2929
3009
  delete Request.requests[this.index];
@@ -3254,7 +3334,7 @@ Polling.prototype.uri = function(){
3254
3334
  return schema + '://' + this.hostname + port + this.path + query;
3255
3335
  };
3256
3336
 
3257
- },{"../transport":14,"component-inherit":21,"debug":22,"engine.io-parser":25,"parseqs":33,"xmlhttprequest":20}],19:[function(_dereq_,module,exports){
3337
+ },{"../transport":14,"component-inherit":21,"debug":22,"engine.io-parser":25,"parseqs":35,"xmlhttprequest":20}],19:[function(_dereq_,module,exports){
3258
3338
  /**
3259
3339
  * Module dependencies.
3260
3340
  */
@@ -3291,6 +3371,7 @@ function WS(opts){
3291
3371
  if (forceBase64) {
3292
3372
  this.supportsBinary = false;
3293
3373
  }
3374
+ this.perMessageDeflate = opts.perMessageDeflate;
3294
3375
  Transport.call(this, opts);
3295
3376
  }
3296
3377
 
@@ -3329,7 +3410,19 @@ WS.prototype.doOpen = function(){
3329
3410
  var self = this;
3330
3411
  var uri = this.uri();
3331
3412
  var protocols = void(0);
3332
- var opts = { agent: this.agent };
3413
+ var opts = {
3414
+ agent: this.agent,
3415
+ perMessageDeflate: this.perMessageDeflate
3416
+ };
3417
+
3418
+ // SSL options for Node.js client
3419
+ opts.pfx = this.pfx;
3420
+ opts.key = this.key;
3421
+ opts.passphrase = this.passphrase;
3422
+ opts.cert = this.cert;
3423
+ opts.ca = this.ca;
3424
+ opts.ciphers = this.ciphers;
3425
+ opts.rejectUnauthorized = this.rejectUnauthorized;
3333
3426
 
3334
3427
  this.ws = new WebSocket(uri, protocols, opts);
3335
3428
 
@@ -3394,12 +3487,13 @@ WS.prototype.write = function(packets){
3394
3487
  // encodePacket efficient as it uses WS framing
3395
3488
  // no need for encodePayload
3396
3489
  for (var i = 0, l = packets.length; i < l; i++) {
3397
- parser.encodePacket(packets[i], this.supportsBinary, function(data) {
3490
+ var packet = packets[i];
3491
+ parser.encodePacket(packet, this.supportsBinary, function(data) {
3398
3492
  //Sometimes the websocket has already been closed but the browser didn't
3399
3493
  //have a chance of informing us about it yet, in that case send will
3400
3494
  //throw an error
3401
3495
  try {
3402
- self.ws.send(data);
3496
+ self.ws.send(data, packet.options);
3403
3497
  } catch (e){
3404
3498
  debug('websocket closed before onclose event');
3405
3499
  }
@@ -3485,7 +3579,7 @@ WS.prototype.check = function(){
3485
3579
  return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
3486
3580
  };
3487
3581
 
3488
- },{"../transport":14,"component-inherit":21,"debug":22,"engine.io-parser":25,"parseqs":33,"ws":35}],20:[function(_dereq_,module,exports){
3582
+ },{"../transport":14,"component-inherit":21,"debug":22,"engine.io-parser":25,"parseqs":35,"ws":37}],20:[function(_dereq_,module,exports){
3489
3583
  // browser shim for xmlhttprequest module
3490
3584
  var hasCORS = _dereq_('has-cors');
3491
3585
 
@@ -3523,7 +3617,7 @@ module.exports = function(opts) {
3523
3617
  }
3524
3618
  }
3525
3619
 
3526
- },{"has-cors":38}],21:[function(_dereq_,module,exports){
3620
+ },{"has-cors":40}],21:[function(_dereq_,module,exports){
3527
3621
 
3528
3622
  module.exports = function(a, b){
3529
3623
  var fn = function(){};
@@ -3999,6 +4093,7 @@ function plural(ms, n, name) {
3999
4093
  */
4000
4094
 
4001
4095
  var keys = _dereq_('./keys');
4096
+ var hasBinary = _dereq_('has-binary');
4002
4097
  var sliceBuffer = _dereq_('arraybuffer.slice');
4003
4098
  var base64encoder = _dereq_('base64-arraybuffer');
4004
4099
  var after = _dereq_('after');
@@ -4013,6 +4108,20 @@ var utf8 = _dereq_('utf8');
4013
4108
 
4014
4109
  var isAndroid = navigator.userAgent.match(/Android/i);
4015
4110
 
4111
+ /**
4112
+ * Check if we are running in PhantomJS.
4113
+ * Uploading a Blob with PhantomJS does not work correctly, as reported here:
4114
+ * https://github.com/ariya/phantomjs/issues/11395
4115
+ * @type boolean
4116
+ */
4117
+ var isPhantomJS = /PhantomJS/i.test(navigator.userAgent);
4118
+
4119
+ /**
4120
+ * When true, avoids using Blobs to encode payloads.
4121
+ * @type boolean
4122
+ */
4123
+ var dontSendBlobs = isAndroid || isPhantomJS;
4124
+
4016
4125
  /**
4017
4126
  * Current protocol version.
4018
4127
  */
@@ -4084,6 +4193,11 @@ exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
4084
4193
  return encodeBlob(packet, supportsBinary, callback);
4085
4194
  }
4086
4195
 
4196
+ // might be an object with { base64: true, data: dataAsBase64String }
4197
+ if (data && data.base64) {
4198
+ return encodeBase64Object(packet, callback);
4199
+ }
4200
+
4087
4201
  // Sending data as a utf-8 string
4088
4202
  var encoded = packets[packet.type];
4089
4203
 
@@ -4096,6 +4210,12 @@ exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
4096
4210
 
4097
4211
  };
4098
4212
 
4213
+ function encodeBase64Object(packet, callback) {
4214
+ // packet data is an object { base64: true, data: dataAsBase64String }
4215
+ var message = 'b' + exports.packets[packet.type] + packet.data.data;
4216
+ return callback(message);
4217
+ }
4218
+
4099
4219
  /**
4100
4220
  * Encode packet helpers for binary types
4101
4221
  */
@@ -4135,7 +4255,7 @@ function encodeBlob(packet, supportsBinary, callback) {
4135
4255
  return exports.encodeBase64Packet(packet, callback);
4136
4256
  }
4137
4257
 
4138
- if (isAndroid) {
4258
+ if (dontSendBlobs) {
4139
4259
  return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
4140
4260
  }
4141
4261
 
@@ -4267,8 +4387,10 @@ exports.encodePayload = function (packets, supportsBinary, callback) {
4267
4387
  supportsBinary = null;
4268
4388
  }
4269
4389
 
4270
- if (supportsBinary) {
4271
- if (Blob && !isAndroid) {
4390
+ var isBinary = hasBinary(packets);
4391
+
4392
+ if (supportsBinary && isBinary) {
4393
+ if (Blob && !dontSendBlobs) {
4272
4394
  return exports.encodePayloadAsBlob(packets, callback);
4273
4395
  }
4274
4396
 
@@ -4284,7 +4406,7 @@ exports.encodePayload = function (packets, supportsBinary, callback) {
4284
4406
  }
4285
4407
 
4286
4408
  function encodeOne(packet, doneCallback) {
4287
- exports.encodePacket(packet, supportsBinary, true, function(message) {
4409
+ exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) {
4288
4410
  doneCallback(null, setLengthHeader(message));
4289
4411
  });
4290
4412
  }
@@ -4562,7 +4684,7 @@ exports.decodePayloadAsBinary = function (data, binaryType, callback) {
4562
4684
  };
4563
4685
 
4564
4686
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4565
- },{"./keys":26,"after":27,"arraybuffer.slice":28,"base64-arraybuffer":29,"blob":30,"utf8":31}],26:[function(_dereq_,module,exports){
4687
+ },{"./keys":26,"after":27,"arraybuffer.slice":28,"base64-arraybuffer":29,"blob":30,"has-binary":31,"utf8":33}],26:[function(_dereq_,module,exports){
4566
4688
 
4567
4689
  /**
4568
4690
  * Gets the keys for an object.
@@ -4760,6 +4882,73 @@ module.exports = (function() {
4760
4882
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4761
4883
  },{}],31:[function(_dereq_,module,exports){
4762
4884
  (function (global){
4885
+
4886
+ /*
4887
+ * Module requirements.
4888
+ */
4889
+
4890
+ var isArray = _dereq_('isarray');
4891
+
4892
+ /**
4893
+ * Module exports.
4894
+ */
4895
+
4896
+ module.exports = hasBinary;
4897
+
4898
+ /**
4899
+ * Checks for binary data.
4900
+ *
4901
+ * Right now only Buffer and ArrayBuffer are supported..
4902
+ *
4903
+ * @param {Object} anything
4904
+ * @api public
4905
+ */
4906
+
4907
+ function hasBinary(data) {
4908
+
4909
+ function _hasBinary(obj) {
4910
+ if (!obj) return false;
4911
+
4912
+ if ( (global.Buffer && global.Buffer.isBuffer(obj)) ||
4913
+ (global.ArrayBuffer && obj instanceof ArrayBuffer) ||
4914
+ (global.Blob && obj instanceof Blob) ||
4915
+ (global.File && obj instanceof File)
4916
+ ) {
4917
+ return true;
4918
+ }
4919
+
4920
+ if (isArray(obj)) {
4921
+ for (var i = 0; i < obj.length; i++) {
4922
+ if (_hasBinary(obj[i])) {
4923
+ return true;
4924
+ }
4925
+ }
4926
+ } else if (obj && 'object' == typeof obj) {
4927
+ if (obj.toJSON) {
4928
+ obj = obj.toJSON();
4929
+ }
4930
+
4931
+ for (var key in obj) {
4932
+ if (obj.hasOwnProperty(key) && _hasBinary(obj[key])) {
4933
+ return true;
4934
+ }
4935
+ }
4936
+ }
4937
+
4938
+ return false;
4939
+ }
4940
+
4941
+ return _hasBinary(data);
4942
+ }
4943
+
4944
+ }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4945
+ },{"isarray":32}],32:[function(_dereq_,module,exports){
4946
+ module.exports = Array.isArray || function (arr) {
4947
+ return Object.prototype.toString.call(arr) == '[object Array]';
4948
+ };
4949
+
4950
+ },{}],33:[function(_dereq_,module,exports){
4951
+ (function (global){
4763
4952
  /*! http://mths.be/utf8js v2.0.0 by @mathias */
4764
4953
  ;(function(root) {
4765
4954
 
@@ -5001,7 +5190,7 @@ module.exports = (function() {
5001
5190
  }(this));
5002
5191
 
5003
5192
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5004
- },{}],32:[function(_dereq_,module,exports){
5193
+ },{}],34:[function(_dereq_,module,exports){
5005
5194
  (function (global){
5006
5195
  /**
5007
5196
  * JSON parse.
@@ -5036,7 +5225,7 @@ module.exports = function parsejson(data) {
5036
5225
  }
5037
5226
  };
5038
5227
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5039
- },{}],33:[function(_dereq_,module,exports){
5228
+ },{}],35:[function(_dereq_,module,exports){
5040
5229
  /**
5041
5230
  * Compiles a querystring
5042
5231
  * Returns string representation of the object
@@ -5075,7 +5264,7 @@ exports.decode = function(qs){
5075
5264
  return qry;
5076
5265
  };
5077
5266
 
5078
- },{}],34:[function(_dereq_,module,exports){
5267
+ },{}],36:[function(_dereq_,module,exports){
5079
5268
  /**
5080
5269
  * Parses an URI
5081
5270
  *
@@ -5116,7 +5305,7 @@ module.exports = function parseuri(str) {
5116
5305
  return uri;
5117
5306
  };
5118
5307
 
5119
- },{}],35:[function(_dereq_,module,exports){
5308
+ },{}],37:[function(_dereq_,module,exports){
5120
5309
 
5121
5310
  /**
5122
5311
  * Module dependencies.
@@ -5161,7 +5350,7 @@ function ws(uri, protocols, opts) {
5161
5350
 
5162
5351
  if (WebSocket) ws.prototype = WebSocket.prototype;
5163
5352
 
5164
- },{}],36:[function(_dereq_,module,exports){
5353
+ },{}],38:[function(_dereq_,module,exports){
5165
5354
  (function (global){
5166
5355
 
5167
5356
  /*
@@ -5210,7 +5399,7 @@ function hasBinary(data) {
5210
5399
  }
5211
5400
 
5212
5401
  for (var key in obj) {
5213
- if (obj.hasOwnProperty(key) && _hasBinary(obj[key])) {
5402
+ if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) {
5214
5403
  return true;
5215
5404
  }
5216
5405
  }
@@ -5223,12 +5412,9 @@ function hasBinary(data) {
5223
5412
  }
5224
5413
 
5225
5414
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5226
- },{"isarray":37}],37:[function(_dereq_,module,exports){
5227
- module.exports = Array.isArray || function (arr) {
5228
- return Object.prototype.toString.call(arr) == '[object Array]';
5229
- };
5230
-
5231
- },{}],38:[function(_dereq_,module,exports){
5415
+ },{"isarray":39}],39:[function(_dereq_,module,exports){
5416
+ module.exports=_dereq_(32)
5417
+ },{}],40:[function(_dereq_,module,exports){
5232
5418
 
5233
5419
  /**
5234
5420
  * Module dependencies.
@@ -5253,7 +5439,7 @@ try {
5253
5439
  module.exports = false;
5254
5440
  }
5255
5441
 
5256
- },{"global":39}],39:[function(_dereq_,module,exports){
5442
+ },{"global":41}],41:[function(_dereq_,module,exports){
5257
5443
 
5258
5444
  /**
5259
5445
  * Returns `this`. Execute this without a "context" (i.e. without it being
@@ -5263,7 +5449,7 @@ try {
5263
5449
 
5264
5450
  module.exports = (function () { return this; })();
5265
5451
 
5266
- },{}],40:[function(_dereq_,module,exports){
5452
+ },{}],42:[function(_dereq_,module,exports){
5267
5453
 
5268
5454
  var indexOf = [].indexOf;
5269
5455
 
@@ -5274,7 +5460,7 @@ module.exports = function(arr, obj){
5274
5460
  }
5275
5461
  return -1;
5276
5462
  };
5277
- },{}],41:[function(_dereq_,module,exports){
5463
+ },{}],43:[function(_dereq_,module,exports){
5278
5464
 
5279
5465
  /**
5280
5466
  * HOP ref.
@@ -5359,7 +5545,7 @@ exports.length = function(obj){
5359
5545
  exports.isEmpty = function(obj){
5360
5546
  return 0 == exports.length(obj);
5361
5547
  };
5362
- },{}],42:[function(_dereq_,module,exports){
5548
+ },{}],44:[function(_dereq_,module,exports){
5363
5549
  /**
5364
5550
  * Parses an URI
5365
5551
  *
@@ -5386,7 +5572,7 @@ module.exports = function parseuri(str) {
5386
5572
  return uri;
5387
5573
  };
5388
5574
 
5389
- },{}],43:[function(_dereq_,module,exports){
5575
+ },{}],45:[function(_dereq_,module,exports){
5390
5576
  (function (global){
5391
5577
  /*global Blob,File*/
5392
5578
 
@@ -5531,7 +5717,7 @@ exports.removeBlobs = function(data, callback) {
5531
5717
  };
5532
5718
 
5533
5719
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5534
- },{"./is-buffer":45,"isarray":46}],44:[function(_dereq_,module,exports){
5720
+ },{"./is-buffer":47,"isarray":48}],46:[function(_dereq_,module,exports){
5535
5721
 
5536
5722
  /**
5537
5723
  * Module dependencies.
@@ -5774,7 +5960,7 @@ Decoder.prototype.add = function(obj) {
5774
5960
  this.reconstructor = new BinaryReconstructor(packet);
5775
5961
 
5776
5962
  // no attachments, labeled binary but no binary data to follow
5777
- if (this.reconstructor.reconPack.attachments == 0) {
5963
+ if (this.reconstructor.reconPack.attachments === 0) {
5778
5964
  this.emit('decoded', packet);
5779
5965
  }
5780
5966
  } else { // non-binary full packet
@@ -5815,11 +6001,15 @@ function decodeString(str) {
5815
6001
 
5816
6002
  // look up attachments if type binary
5817
6003
  if (exports.BINARY_EVENT == p.type || exports.BINARY_ACK == p.type) {
5818
- p.attachments = '';
6004
+ var buf = '';
5819
6005
  while (str.charAt(++i) != '-') {
5820
- p.attachments += str.charAt(i);
6006
+ buf += str.charAt(i);
6007
+ if (i + 1 == str.length) break;
5821
6008
  }
5822
- p.attachments = Number(p.attachments);
6009
+ if (buf != Number(buf) || str.charAt(i) != '-') {
6010
+ throw new Error('Illegal attachments');
6011
+ }
6012
+ p.attachments = Number(buf);
5823
6013
  }
5824
6014
 
5825
6015
  // look up namespace (if any)
@@ -5837,7 +6027,7 @@ function decodeString(str) {
5837
6027
 
5838
6028
  // look up id
5839
6029
  var next = str.charAt(i + 1);
5840
- if ('' != next && Number(next) == next) {
6030
+ if ('' !== next && Number(next) == next) {
5841
6031
  p.id = '';
5842
6032
  while (++i) {
5843
6033
  var c = str.charAt(i);
@@ -5929,7 +6119,7 @@ function error(data){
5929
6119
  };
5930
6120
  }
5931
6121
 
5932
- },{"./binary":43,"./is-buffer":45,"component-emitter":9,"debug":10,"isarray":46,"json3":47}],45:[function(_dereq_,module,exports){
6122
+ },{"./binary":45,"./is-buffer":47,"component-emitter":9,"debug":10,"isarray":48,"json3":49}],47:[function(_dereq_,module,exports){
5933
6123
  (function (global){
5934
6124
 
5935
6125
  module.exports = isBuf;
@@ -5946,9 +6136,9 @@ function isBuf(obj) {
5946
6136
  }
5947
6137
 
5948
6138
  }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5949
- },{}],46:[function(_dereq_,module,exports){
5950
- module.exports=_dereq_(37)
5951
- },{}],47:[function(_dereq_,module,exports){
6139
+ },{}],48:[function(_dereq_,module,exports){
6140
+ module.exports=_dereq_(32)
6141
+ },{}],49:[function(_dereq_,module,exports){
5952
6142
  /*! JSON v3.2.6 | http://bestiejs.github.io/json3 | Copyright 2012-2013, Kit Cambridge | http://kit.mit-license.org */
5953
6143
  ;(function (window) {
5954
6144
  // Convenience aliases.
@@ -6811,7 +7001,7 @@ module.exports=_dereq_(37)
6811
7001
  }
6812
7002
  }(this));
6813
7003
 
6814
- },{}],48:[function(_dereq_,module,exports){
7004
+ },{}],50:[function(_dereq_,module,exports){
6815
7005
  module.exports = toArray
6816
7006
 
6817
7007
  function toArray(list, index) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socket.io-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Chen