Getting IRC working properly on the iPhone

Overcoming Apple’s boundaries with Palaver and ZNC

Eric Turner
Eric Turner’s Blog

--

Recently I’ve been searching for an IRC app for the iPhone. But I found none of them deliver a very good experience, since Apple limits how long you can keep connections open in the background. So about 10 minutes after closing the app it stops sending push notifications for new messages.

However, it turns out there’s a fairly straightforward way of getting around this limitation using something called an IRC bouncer. Here are the steps that I took to get IRC working properly on my iPhone.

  • ZNC (IRC bouncer, free)
  • A place to run the ZNC server (ideally a VPS like Linode, Digital Ocean or EC2).
  • The ZNC-Palaver ZNC module (to enable push notifications).
  • Palaver (IRC client for iOS, $2.99).
  • Homebrew (if you’re installing locally on a mac, which I don’t actually recommend)

Installing ZNC

First things first, we have to install ZNC.

If you’re on Linux (Ubuntu/Debian or CentOS/Fedora/RedHat), please follow my instructions here to install ZNC from source. For other distritbutions, please see the ZNC Wiki for install instructions.

If you’re running OS X, the easiest way is to use homebrew.

brew install znc

and you’re done.

Configuring ZNC

Now it’s time to setup ZNC how we want it. The best way to do this is to make a new user account that we can use to administrate the server (run as root or using sudo):

adduser znc-admin

Next, let’s set a password for the user:

passwd znc-admin

and then follow the prompts to set the password to whatever you like.

Switch to the new user:

su znc-admin

You’ll be asked to enter the password you just set.

Next, CD into znc-admin’s home directory:

cd ~

And create your ZNC config file:

vnc --makeconf

This will begin an interactive dialogue for setting up the server configuration. Choose what port you want the server to listen on (I chose 4321 but any unused port should work):

What port would you like ZNC to listen on? (1025 to 65535): 4321

Enter ‘yes’ to use SSL (and enter yes again if you get an error about a missing pem file):

Would you like ZNC to listen using SSL? (yes/no) [no]: yes

Enter ‘yes’ to allow both IPv4 and IPv6 addresses:

Would you like ZNC to listen using both IPv4 and IPv6? (yes/no) [yes]: yes

Depending on your VPS, you may be better off setting this to ‘no’ (for example Digital Ocean doesn’t support IPv6), but it shouldn’t really matter.

Load the partyline module (it’s required if you want to use IRC):

Load global module <partyline>? (yes/no) [no]: yes

Load the webadmin module (for controlling ZNC from your web browser) :

Load global module <webadmin>? (yes/no) [no]: yes

Create a user/password for logging into ZNC itself (you’ll need this for the web admin panel):

Username (AlphaNumeric): testuser  
Enter Password: ******************
Confirm Password: ******************

Enter yes to set the user as an admin :

Would you like this user to be an admin? (yes/no) [yes]: yes

Then you can set your IRC settings. I used the following settings but you’ll want to replace them with your own personal info:

Nick [testuser]: testuser  
Alt Nick [testuser]: testuser_
Ident [testuser]: testuser
Real Name [Got ZNC?]: Test User
Bind Host (optional): < (you can leave this blank) >
Number of lines to buffer per channel [50]: 50
Would you like to clear channel buffers after replay? (yes/no) [yes]: yes
Default channel modes [+stn]: +stn

Next it will ask if you want to load some more modules; I would choose yes for all of them:

Load module <chansaver>? (yes/no) [no]: yes  
Load module <controlpanel>? (yes/no) [no]: yes
Load module <perform>? (yes/no) [no]: yes

Now it’s time to enter the info for the network you want to connect to. I’ll use the #atom channel at irc.freenode.net as an example, but you’ll want to choose your own channel(s) here:

Would you like to set up a network? (yes/no) [no]: yes  
Network (e.g. 'freenode' or 'efnet'): freenode

It will then ask you if you want to enable modules for this specific network. You can read up on the various modules here and choose which ones you want to install. Again I chose to install each of them:

Load module ? (yes/no) [no]: yes  
Load module <keepnick>? (yes/no) [no]: yes
Load module <kickrejoin>? (yes/no) [no]: yes
Load module <nickserv>? (yes/no) [no]: yes
Load module <perform>? (yes/no) [no]: yes
Load module <simple_away>? (yes/no) [no]: yes

Next, we set the address and port, and the password (if required) for the server:

IRC server (host only): irc.freenode.net  
[irc.freenode.net] Port (1 to 65535) [6667]: 6667
[irc.freenode.net] Password (probably empty): <(leave blank)>

Choose whether you want to connect using SSL (I do):

Does this server use SSL? (yes/no) [no]: yes

It will then ask if you want to connect to any other servers. I don’t, so I answered no:

Would you like to add another server for this IRC network? (yes/no) [no]: no

Then choose what channel(s) you want to automatically connect to and finish:

Would you like to add a channel for ZNC to automatically join? (yes/no) [yes]: yes  
Channel name: #atom
Would you like to add another channel? (yes/no) [no]: no
Would you like to set up another network? (yes/no) [no]: no
Would you like to set up another user? (yes/no) [no]: no
Launch ZNC now? (yes/no) [yes]: yes

Now ZNC should be running. You can confirm this by accessing the web admin panel at https://:. For example if you were running on your local machine and port 4321 it would be https://localhost:4321.

If you’re using SSL you’ll probably see a screen that looks something like this:

Just proceed to the next page, and you should end up here:

If you want you can login and check out the settings, but for now we don’t need to change anything, we’re just making sure it works.

That’s the end of the ZNC setup. Next, let’s download and setup the iOS app that we’ll use to connect to our new server!

Installing Palaver

Simply download the app from the app store and install it.

Setting up Palaver

This is pretty straightforward too. When you first startup the app, it will look like this:

Not very exciting. So let’s add a connection to our server. Click the plus sign in the upper left, and use the following settings (replacing my info with your own):

Then click on “Authentication” and enter your settings. Here’s what I used:

Then click “Done” and it should automatically connect to your server and join the channels you’ve specified:

Voila! We now have a functioning connection to the server and can use Palaver normally without dropped connections, but there’s still one more problem: in our current state we still won’t receive push notifications. Which brings us to our last step, installing the palaver ZNC module.

Enabling push notifications with ZNC-Palaver

Download the znc-palaver source files via git:

$ git clone https://github.com/Palaver/znc-palaver

Cd to the created directory:

$ cd znc-palaver

Compile the package:

make

Copy the compiled .so file to .znc/modules

cp palaver.so ~/.znc/modules

Then load the module from within palaver:

/msg *status loadmod palaver

Now, all messages that get sent while the app is closed should be available when you re-open the app, and push notifications should work:

Beautiful.

If you have any feedback or questions about this post, please feel free to leave me a comment!

--

--