What is Matrix?

I am working on bringing Matrix to the WordPress community (see also the WP Tavern post) and part of this is also to explain what Matrix actually is, so I wrote up a few paragraphs that I’d like to share here:

Matrix is an internet-based chat system like Slack or Microsoft Teams with a few key differences:

Open Source

It is open source (Apache License 2.0). Thus it includes the four freedoms (run it for any purpose, modify it, distribute it or a modified version).

Federated

There is no centrally controlled server, similar to e-mail (or ActivityPub): to send and receive e-mail, you need to have an account on a mail server. In Matrix, these servers are called homeservers.

When you send messages, these messages are first sent from your client (computer or phone) to the server, from the server to the recipients’ servers (in e-mail, you manually list them, in Matrix, these are all other people in the room), and then the messages are delivered to the individual participant’s clients. The benefit of this is that the client (like a mobile phone app) doesn’t need to be connected when the server receives the message and can catch up when it comes back online. 

For this reason, Matrix account addresses look similar to e-mail (or Mastodon) addresses but they have the format @username:server.tld. Starting when a member of a homeserver joins a room, their homeserver will maintain a full, up-to-date copy of the chat room. Any message sent by others in the room will be sent to every participating homeserver. For this reason, joining a room can take a while because the server needs to (partially) populate its local copy from other homeservers. Because of the real-time nature of chat, the messages are exchanged very quickly between the homeservers as soon as that connection has been established.

A Matrix server can also be run in unfederated mode where it will not communicate with other servers on the internet, thus enabling a closed community. This decision can also be made on a room-by-room basis.

Encryption

Matrix rooms can be either unencrypted and openly discoverable, or end-to-end encrypted and invite-only. Because the server has no knowledge of contents or encryption keys, the latter need to be shared between the individual client software of a user. This is established through a verification step in which you use your other/old client to establish trust with the new one. Until this has happened, any encrypted communication is inaccessible.

Open Protocol

The Matrix protocol (and all of its updates, called MSC) is publicly available and can be implemented by any software. There are a couple of server implementations with best known ones by Element themselves, called Synapse (Python based) and Dendrite (Go based). Clients are easier to implement through Matrix provided SDKs that do the heavy lifting of encryption and protocol communication.

Free Choice of Clients

For the above reason, there is a wide selection of clients for mobile and desktop, different operating systems, text based, etc. We have developed a WordPress plugin called Chatrix that allows embedding Matrix inside a WordPress post or page which allows something like we demonstrated in this GIF:

3 thoughts on “What is Matrix?

  1. Thanks for this!

    I would have a question about this part:

    Starting when a member of a homeserver joins a room, their homeserver will maintain a full, up-to-date copy of the chat room. Any message sent by others in the room will be sent to every participating homeserver. For this reason, joining a room can take a while because the server needs to (partially) populate its local copy from other homeservers

    What happens if different homeservers have a different local copy (maybe one of them is corrupted, incomplete, altered)? Which server acts as the source of truth in case of conflicts?

  2. I love this and I’m hoping I find time to look into it again. I say again because I tried this out as soon as I saw you publish it on GitHub. Everything seems great at first but I started noticing quirks. All of which may be my fault. For example, I would try signing in from another device, or get logged out and log back in, and then suddenly I couldn’t find the server or room I created.

    I was thinking it could be because I was trying to use Matrix’s main server. Maybe a moderation removed the room I created or something like that.

    I don’t think what I experienced has to do with the plugin; it’s probably Matrix itself mixed with me not fully understanding how it works.

Leave a Reply

Only people in my network can comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.