Created
April 3, 2015 05:20
-
-
Save xingped/5bdb74bd87f4f8b603ed to your computer and use it in GitHub Desktop.
Example of connection problem with twitch-irc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html ng-app="testApp"> | |
<head> | |
<script type="text/javascript" src="node_modules/angular/angular.js"></script> | |
</head> | |
<body ng-controller="testCtrl"> | |
test | |
</body> | |
<script> | |
(function() { | |
var testApp = angular.module('testApp', []); | |
testApp.controller('testCtrl', ['$timeout', function($timeout) { | |
var irc = require('twitch-irc'); | |
var client = new irc.client({ | |
options: { | |
debug: true, | |
debugDetails: true | |
}, | |
identity: { | |
username: 'wrong', | |
password: 'wrong' | |
}, | |
connection: { | |
preferredServer: 'irc.twitch.tv' | |
}, | |
channels: ['#xingped'] | |
}); | |
client.connect(); | |
client.addListener('chat', function(channel, user, message) { | |
console.log(user.username+' - '+message); | |
}); | |
$timeout(function() { | |
client.disconnect(); // <-- Comment out this line to expose problem | |
client.options.identity = { | |
username: 'xingped', | |
password: 'oauth:...' // <-- Add your oauth key here | |
} | |
client.connect(); | |
}, 5000); | |
}]); | |
})(); | |
</script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "AngularTest", | |
"main": "index.html", | |
"window": { | |
"toolbar": true, | |
"width": 100, | |
"height": 100 | |
}, | |
"dependencies": { | |
"twitch-irc": "*", | |
"angular": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment