Perpetual IRC – The Multiplexer Edition
As is the case with most people involved in Open Source, I’m on IRC all day long. I can help people from around the world use some of the projects I’ve helped create, as well as some of the software that I use on a daily basis.
Additionally, IRC is also the preferred form of group communication for the company I work for. One of the major advantages that IRC has over your ‘traditional’ instant messenger clients is that, with a minimum amount of effort and hardware, you can create a setup that will remain perpetually* connected, even when you’re not online. That means that you can keep logs of conversations, receive messages, catch up on what the current topic of discussion is when starting your day, and still be able to shut down your computer at night if you so choose.
There are a few ways of achieving the status of perpetual IRC denizen. Note, however, that almost any method requires that you have access to a remote server in addition to your local machine. It doesn’t need to be anything special – a cheap VPS will do just fine, as long as you can install software packages and open the necessary ports in the firewall.
Simplest. If you want to expend the least amount of effort, at the cost of some flexibility, the easiest method of achieving IRC immortality is with the use of a terminal multiplexer, such as screen or tmux (my personal favourite), and a console-based IRC client, such as Irssi.
Don’t know what a terminal multiplexer is? Here’s a description, right from the screen homepage:
Screen is a terminal multiplexer: it takes many different running processes and manages which of them gets displayed to the user. Think of it as a window manager for your console or terminal emulator. With screen, you can have interactive processes running on your home computer and connect to them from anywhere else to check on their progress.
Let’s assume that you’ve installed screen and Irssi on your remote server. What we want to do is start Irssi inside a screen session:
Digression. At this point, feel free to browse the documentation on how to properly setup your preferred servers, channels and other configuration parameters for the IRC client. For a quick test, you can try the following at the Irssi prompt:
You can also automate the process, so that upon startup Irssi will auto-connect to the servers and channels you specify:
/network add -nick YourNickName Freenode
/channel add -auto #some-interesting-channel Freenode
If you have a registered nickname, you can have it auto-identify as well:
And you’ll probably want to cut down on the noise:
At this point, you should have a fully functioning IRC client inside of a screen session. You can detach from the current session by pressing control-a d, and re-attach with:
See where this is going? With this setup, you can simply maintain your IRC connection within a screen session on your remote server. When you want to “log on”, you simply SSH into your remote server, screen -r, and voilà! Perpetual IRC.
This approach, while simple, has some very obvious drawbacks:
- You must be on a machine that is able to SSH into your remote server.
- You are confined to using the command-line IRC client running in the remote session.
- Any scripts that attempt to interact with your ‘local’ desktop (e.g. Growl notifications), are painful to setup, if not impossible.
Okay, so it’s not completely ideal. But it does the job – as long as your remote screen session remains operational, you’ll be logged in to IRC.
In my next post, we’ll look at how you can achieve the same results, but without any of the aforementioned drawbacks, through the use of a specialized IRC proxy daemon.
*: Of course, if the remote server running the terminal multiplexer session goes down, it’s not really ‘perpetual’.