Skip to content

A very basic browser-based IRC client that can connect via websocket to eg. UnrealIRCd 5+

License

Notifications You must be signed in to change notification settings

oelna/websocket-irc

Repository files navigation

Javascript IRC client using websockets

A very basic browser-based IRC client that can connect via websocket to eg. UnrealIRCd 5+

Stackoverflow posts like this one had me wondering whether it was possible at all, but advances in IRC server software over the years have indeed made it feasible to have an IRC client that runs only in the browser and connects to the server without intermediary server code. This is because IRC servers often deal with the websocket layer themselves nowadays.

I spent some time and tried a few things to make it work, and I think it does. I liked the idea mainly for privacy reasons: there is no middle man between you and the IRC server, which you're connected to via WSS.

It's most certainly not perfect. Take it as a proof of concept. I don't know whether it scales. Or if it has performance issues, warnings or bugs. I tested it for some time and use it myself for communication with friends and students, since many popular messaging solutions have privacy implications. It's working so far and nothing has happened that a browser refresh would not fix.

Features

  • Enter server URL and port in the UI
  • Auto-connect to specified channels
  • Show available channels
  • Display users currently in a channel
  • Input history (up/down arrow keys) makes spamming easy (is that even a good thing?)
  • (very naive) Vue v3 app
  • Tabbed interface
  • Support for direct messages between users in a convenient interface (shows the last 6 messages, configurable)
  • A decent light and dark theme that auto-switches and has a manual toggle
  • Okay HTML makes it possible to style everything yourself, if that's your thing
  • Basic support for links and images
  • A few Octicons icons here and there, where I thought they were helpful

Gotchas

  • It has to connect over WSS, simple WS does not work
  • I depend on the server supporting echo-message, message-tags and server-time
  • Only a few basic IRC functions are exposed in the UI
  • I only tested this in recent versions of Chrome and Safari
  • The design uses -system-ui as font, but I only ever see San Francisco, since I'm on Mac/iOS
  • I know nothing about NickServ or ChanServ, so this does not support or use either
  • Connection errors are mostly silent and invisible, so you don't know what failed

Installation

Put the files on a server and call the URL. That's it.

Test by connecting to irc.unrealircd.org on port 443 and you should see a list of available channels for you to join.

Feedback and improvements

I welcome input! I don't know much about anything, really, and if somebody finds this and knows how to make it better, let me know, write an issue or PR. If you like this and want to support my open source work, feel free to give back via my Patreon or Paypal. Any amount helps and is appreciated!

References used

I put these here mainly so I can close a bunch of browser tabs and will later know how I learned about this stuff. Also, if I want to add features later, I will need these links.

IRC commands

IRC message parsing

Websockets and UnrealIRCd