From 5557e88b047b2d6f00051623a1ea2ce87c636d8e Mon Sep 17 00:00:00 2001 From: Matthew McNamara Date: Fri, 3 Apr 2015 18:20:00 +0100 Subject: [PATCH] Version bump. Ignore xhr poll error, socket.io will reconnect eventually. Fixes #1 (sort of :T) --- README.md | 10 +++++----- index.js | 4 +++- package.json | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 62ac31a..96e2bc2 100644 --- a/README.md +++ b/README.md @@ -20,28 +20,28 @@ var listener = new Streamtip(opts); listener.on('connected', function() { // Successfully connected to Streamtip, but not authenticated yet! console.log('connected!'); -} +}); listener.on('authenticated', function() { // Now authenticated, we can expect tip alerts to come through console.log('authenticated!'); -} +}); listener.on('authenticationFailed', function() { // ClientID or Access Token was rejected console.log('authentication failed!'); -} +}); listener.on('newTip', function(tip) { // We got a new tip. // 'tip' is an object which matches the description given on the Streamtip API page console.log('new tip! %s has tipped %s%s!', tip.username, tip.currencySymbol, tip.amount); -} +}); listener.on('error', function(err) { // An unexpected error occurred console.log('error! %s', err.message); -} +}); ``` ### Contributing diff --git a/index.js b/index.js index ff4eed1..4c75c2f 100644 --- a/index.js +++ b/index.js @@ -23,8 +23,10 @@ function StreamTip(options) { }); this._socket.on('error', function(err) { - if(err === '401::Access Denied::') { + if (err === '401::Access Denied::') { self.emit('authenticationFailed'); + } else if (err.message === 'xhr poll error') { + // ignoring xhr poll error, socket.io will reconnect } else { self.emit('error', err); } diff --git a/package.json b/package.json index b5a76e0..81ca88e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "streamtip-listener", - "version": "1.0.1", + "version": "1.1.0", "description": "Evented wrapper API for StreamTip", "main": "index.js", "keywords": [