matrix logo

Matrix is the chat platform of the future.

Overview

I've been playing with setting up a Matrix homeserver this week. That's because I've gotten somewhat fed up with Slack's walled garden approach, and want something I can host myself. Ideally, I would like to be able to smoothly transition into using it without endangering the community I've got on Slack.

Matrix fits that bill. It integrates with many existing chat platforms, allowing you to switch to it without anyone losing touch with you (more on that later). There's a few other advantages as well, but before we get there I should cover some basic concepts about how it works.

Matrix itself is an API and protocol definition for distributed chat. What you'd actually run, use, or connect to is an implementation of part of the Matrix definition. At the very least, you will need a client and a homeserver. A homeserver is a node that connects to the wider Matrix network and essentially acts as a message forwarder. Your client communicates with it, and it communicates with other homeservers that speak the same language.

The Matrix setup offers these advantages:

  • Matrix is fully distributed and federated. You can join a chat room on your own homeserver, and it will replicate all of that room's messages. All the homeservers on which that room exists will begin talking with yours (federation) and share messages. Note how there's no concept of room ownership (fully distributed). Rooms can be set up to be private, requiring an invitation to join, but once someone joins they have as much ownership in the room as anyone else.
  • Matrix supports end-to-end encryption. I'm a little fuzzy on how exactly it works, but it uses the Double Ratchet Algorithm to provide the end-to-end encrypted guarantee. Thus, though your room may be replicated across who-knows-how-many homeservers, your messages are not readable by anyone but the room members (note that bridges to other networks complicate this - if your room is bridged to Slack, your messages are encrypted up to the bridge and no further).

Pros & Cons

The best part about Matrix is the existence of (and emphasis on) bridges to interconnect with other chat services. XKCD laments the balkanization of chat platforms, with everyone using a subset. Matrix intends to set you up to talk to all of these platforms from within one service. Since it does this by bridging existing Matrix rooms into other services, it can also serve as a bridge between users of disparate services who don't use Matrix. As of the time of writing, the following bridges exist:

  • Blog comments
  • Discord
  • Email
  • Gitter
  • Hangouts
  • IRC
  • Instagram
  • Minecraft server chat
  • Rocketchat
  • SMS
  • Slack
  • Telegram
  • Twilio
  • Twitter
  • XMPP
  • iMessage
  • libpurple (most traditional IM services - Bonjour, XMPP, IRC, Jabber, etc)

The worst part about Matrix right now is that there's only one homeserver implementation, and it's in Python2 and not very performant. However, matrix.org's instance has scaled to something like ~400k total users, so it definitely gets the job done for now. There are several others in the works: notably one written in Go by the original developers expressly to replace Synapse (Dendrite) and one written in Rust (Ruma). Both should be far less resource-intensive than the Python version when they're done.