socket.io-rails 1.0.5 → 1.0.6

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: aa3e436bf211e5063bbf2d958116b0b7fc89fd6b
4
- data.tar.gz: 8d8ede182179bc03fdf972a238b2fcf1fcc25121
3
+ metadata.gz: ae004a0e89d45dcf2aab359f03c9371f722ac8ea
4
+ data.tar.gz: 9caad930a2db41dbd687fdebf23d58758dee98b8
5
5
  SHA512:
6
- metadata.gz: d6443dfd027388723895f665851b5b9757d550a0b4543d4d0215ad7ff35b5eb44cacd12c8cd01e983617d52adf927225a32942fdae32577fa3ca8283af7ed78e
7
- data.tar.gz: 986e8942506544830789c62c4719cac3945a4dc086786fae3db5c9f5bcde4927bac753df1cb250b8c3a24647d9b6155e1becd7ad857991da54e96070184795be
6
+ metadata.gz: 7589d32f8ad710d3cd080054f396ea949a7d08e09055c95218e48e700881261ea7a15b75498295fe9fab7935c061c26de84c4c06583c44f9be31eb1b5d3753de
7
+ data.tar.gz: 78d7ffb75cb350a3b398e258ede2a457aef1d669a285e9fd5cb63351945f8dad964e1ec6d261a23ec550019f597809027967dc46e93cb8c185154b5237805956
@@ -1,5 +1,5 @@
1
1
  module Socketio
2
2
  module Rails
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
@@ -514,7 +514,7 @@ Manager.prototype.reconnect = function(){
514
514
  this.reconnecting = true;
515
515
  var timer = setTimeout(function(){
516
516
  debug('attempting reconnect');
517
- self.emitAll('reconnect_attempt');
517
+ self.emitAll('reconnect_attempt', self.attempts);
518
518
  self.emitAll('reconnecting', self.attempts);
519
519
  self.open(function(err){
520
520
  if (err) {
@@ -640,6 +640,7 @@ function Socket(io, nsp){
640
640
  this.sendBuffer = [];
641
641
  this.connected = false;
642
642
  this.disconnected = true;
643
+ this.subEvents();
643
644
  }
644
645
 
645
646
  /**
@@ -649,21 +650,31 @@ function Socket(io, nsp){
649
650
  Emitter(Socket.prototype);
650
651
 
651
652
  /**
652
- * Called upon engine `open`.
653
+ * Subscribe to open, close and packet events
653
654
  *
654
655
  * @api private
655
656
  */
656
657
 
657
- Socket.prototype.open =
658
- Socket.prototype.connect = function(){
659
- if (this.connected) return this;
658
+ Socket.prototype.subEvents = function() {
660
659
  var io = this.io;
661
- io.open(); // ensure open
662
660
  this.subs = [
663
661
  on(io, 'open', bind(this, 'onopen')),
664
662
  on(io, 'packet', bind(this, 'onpacket')),
665
663
  on(io, 'close', bind(this, 'onclose'))
666
664
  ];
665
+ };
666
+
667
+ /**
668
+ * Called upon engine `open`.
669
+ *
670
+ * @api private
671
+ */
672
+
673
+ Socket.prototype.open =
674
+ Socket.prototype.connect = function(){
675
+ if (this.connected) return this;
676
+
677
+ this.io.open(); // ensure open
667
678
  if ('open' == this.io.readyState) this.onopen();
668
679
  return this;
669
680
  };
@@ -2284,8 +2295,14 @@ Transport.prototype.onOpen = function () {
2284
2295
  * @api private
2285
2296
  */
2286
2297
 
2287
- Transport.prototype.onData = function (data) {
2288
- this.onPacket(parser.decodePacket(data, this.socket.binaryType));
2298
+ Transport.prototype.onData = function(data){
2299
+ try {
2300
+ var packet = parser.decodePacket(data, this.socket.binaryType);
2301
+ this.onPacket(packet);
2302
+ } catch(e){
2303
+ e.data = data;
2304
+ this.onError('parser decode error', e);
2305
+ }
2289
2306
  };
2290
2307
 
2291
2308
  /**
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.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Chen