Foray into IRC, with the help of ZNC

Why IRC?

As someone relatively new to the developers scene, I’ve been rather intimidated by chatting on IRC. I used it a couple times in the past in order to get some help on open-source projects, and those experiences were at the most confusing. There is usually a lot of noise, so it’s difficult to keep track of what’s going on. This problem is exacerbated by the fact that most IRC clients do not keep track of history, so if for some reason you’re disconnected from a chat, say you need to close your computer for a while or your network fails, there is no way to retrieve what was said during that downtime.

I tried out irccloud, and it was a pretty good option. With the free plan, I am able to stay connected for up to 2 hours after I become inactive, which definitely helps with the scenario described above. I mostly use IRC on my desktop, but the irccloud mobile apps come in pretty handy if I need to step out for a bit. On the desktop, the only option is to use the webapp, which has desktop notification, and since I use my email as webapps anyway, I didn’t mind it too much.

What is ZNC?

Recently, I’ve been more interested in doing some self-hosting, and IRC seems like an interesting experiment to try that out with. More specifically, I wanted to try hosting my own IRC bouncer. I had no idea what that means before, until somebody on the LGBTQ Slack chat mentioned ZNC, an IRC bouncer. Basically, it is a middle man between your IRC client and the IRC server. Instead of connecting to the IRC server directly, you connect it the bouncer, which then relays you to the server. If you become disconnected, the bouncer will stay connected and maintain a buffer of messages while you’re gone, and allow you to catch up later. By default, the size of this buffer is 50, which I think is most likely sufficient for IRC (just enough to provide you with the context of the current conversation), but you can definitely increase this size to be whatever you want.

Just like most things related to IRC, the ZNC website contains a lot of useful information, but not the friendliest for the absolute beginners. So with this post, I want to detail my experience setting it up from scratch with very little knowledge on how it all works. I spent quite a bit of time figuring it out on my own, so I hope it will be useful and save someone else some of their precious time.

Run ZNC with docker

First, I decided to not install and run ZNC as the website instructed, but instead running it with docker. This way, it is more contained and repeatable, so I had some room to make mistakes with. I’ve been into the whole docker workflow lately. Thanks to jimeh/znc image, this setup is quite simplified. After installing docker on your host (in this case, I am using a Digital Ocean droplet), you can pull this image down and run the container:


:; docker pull jimeh/znc  # this step is optional
:; docker run -d --name znc -p 6667:6667 -v $HOME/.znc:/znc-data jimeh/znc

What each of the flag does:

Note: I use port 6667 here, while the doc for jimeh/znc shows an example of 36667. Either option would work, as you can specify which port to connect to from your client. Most clients default to port 6667, so I chose it for convenience. There’s a slight problem with this choice however – in the next step, when configuring ZNC at http://host-ip:6667, this page will not appear on Chrome as port 6667 is blocked. However, the ZNC server can still be accesssed on a different browser, such as Firefox.

Configure ZNC server

Now that we have ZNC running, we can start configuring it by going to http://host-ip:6667, where host-ip is the address of the host machine, and 6667 is the port on the host machine that we set in the docker run command above.

Log in with the username/password combination is admin/admin. You’re advised to create your own administrator user:

I’d recommend you create your own user by cloning the admin user, then ensure your new cloned user is set to be an admin user. Once you login with your new user go ahead and delete the default admin user.

Once logged in, you can add an IRC server for ZNC to connect to, such as freenode.

You can now add a list of channels you want to be able to connect to through the ZNC interface. You can also just join any channel with the command /join #channel-name from the IRC client, and ZNC will create these channels for you. Once you have a list of channels you belong to, you can change the size of buffer (to something other than 50) from the ZNC interface.

That is it. Now you can start using IRC through your ZNC bouncer and enjoying benefits such as the message buffer. To be completely honest, I am still pretty much a noob when it comes to ZNC. I am sure there are a lot of super amazing features you could do with ZNC to make your IRC experience better. If you know of some of these, please let me know! I would love to learn.

Set up IRC client with Textual

There are many IRC clients out there, include WeeChat, a CLI client. I went with Textual as it is highly recommended and has support for ZNC bouncer built in. It is not a free app however, though its cost is not too high ($4.99 right now).

Once you open Textual, add a new server and fill out the fields under the “General” tab as follows:

In the “Identity” tab, you can have “Username” set as <username>/<network>, while “Nickname” can be whatever nick name you desire.

If your channel requires your nickname to be registered with a password, you can do it with this command:

/msg NickServ REGISTER <password> <email>

Later on, when you connect again, you can identify yourself with:

/msg NickServ IDENTIFY <nickname> <password>

Bonus: connect to gitter through IRC and ZNC

An alternative to IRC for Github-hosted open-source projects that has been growing in popularity is gitter. It overcomes a lot of IRC limitations with some impressive features, such as full message history, markdown syntax support for writing messages (back ticks are amazing for writing code blocks), message editing and deleting etc. Some open-source projects have been adopting it, such as AmpersandJS. While I like using it, I do not particularly like how to desktop app (which is essentially a wrapper around the webapp) constantly displays an unread badge and I cannot seem to be able to hide it. This is too distracting for me. Thankfully, there is a way to actually connect to gitter via an IRC client, thanks to irc.gitter.im. This allows me to group gitter chats with regular IRC channels.

We can use our ZNC bouncer to connect to the irc.gitter.im server, and then our IRC client like Textual can just connect to the ZNC server.

First, you need to get the gitter token (from the irc.gitter.im page).

Then, add gitter as a network on your ZNC server. This is essentially the same as the steps outlined above, with a few differences:

The steps to connect from Textual is exactly the same as before, since ZNC already took care of authentication with gitter. The only difference is that you need to set the Nickname as your Github username.

These days, I have the Textual app open in the background and it automatically connects to the ZNC server. I am not active on any IRC channel, as I much prefer using something like Slack, but it’s kinda fun to pop in and see what’s going on. I would keep a few channels that I care about open, such as #node.js, #docker, #AmpersandJS/AmpersandJS or #w3c/a11ySlackers. I still think that IRC is rather intimidating, and its interface outdated and not very user-friendly. However, I find the idea of connecting to many others around the world who care about the same topic with such low barrier to entry to be quite powerful. That is I am investing some time and effort into making it as pleasant an experience as possible.

comments powered by Disqus