Skip to content

Instantly share code, notes, and snippets.

@xingped
Created April 3, 2015 05:20
Show Gist options
  • Save xingped/5bdb74bd87f4f8b603ed to your computer and use it in GitHub Desktop.
Save xingped/5bdb74bd87f4f8b603ed to your computer and use it in GitHub Desktop.
Example of connection problem with twitch-irc
<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>
{
"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