Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
Version bump. Ignore xhr poll error, socket.io will reconnect eventua…
Browse files Browse the repository at this point in the history
…lly. Fixes #1 (sort of :T)
  • Loading branch information
Matthew McNamara committed Apr 3, 2015
1 parent a916d15 commit 5557e88
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down

0 comments on commit 5557e88

Please sign in to comment.