I recommend using tmi.js as it can also be used in the browser. Here’s the documentation for tmi.js.
<script src="//cdn.tmijs.org/js/latest/tmi.js"></script>
<script>
var nick = '',
auth = '',
channel = '',
client = new irc.client({
connection: {
reconnect: true,
secure: true
},
identity: {
username: nick,
password: auth
},
channels: [channel]
});
client.on('message', (channel, user, message, fromSelf) {
console.log(fromSelf ? '[YOU]' : '', channel.slice(1, 5), user['display-name'] + ':', message);
if(fromSelf) {
return false;
}
/* etc ... */
});
client.connect();
</script>
There are some updates that will be coming to tmi.js soon in the next branch.