Mastodon

Matrix, Dendrite and Element

Send to Kindle

A more accurate headline would have been Matrix.org, Dendrite and Element.io.

Even though I had intended to (and continue to intend to) blog regularly, for a number of reasons, I ended up not blogging in March at all. Don’t cry for me, it was a very good month in every other way, but I did miss writing, so here I am back in the groove…

My recent post on Mastodon made the point that it was more of an experiment than a commitment. Now that I’ve used it for over month, I’m likely sticking with it (in much the way that I was using Twitter, meaning more as a lurker than a poster, but who knows, posting may follow as well…).

Through Mastodon, I have discovered other distributed services that I was either unaware of, or very peripherally aware of. I tried to educate myself about a number of them (and am always glad to learn), but the one that intrigued me the most was Matrix.org. It didn’t intrigue me from the perspective of “wow, now I can communicate with people more easily” (in fact I have way too many ways to communicate that mostly work really well!). Basically, like with Mastodon (originally), I was more interested in the technical aspect of getting a Matrix.org server (from now on, just Matrix) up and running.

The first step was in choosing which server software to install. Apparently, Synapse is the most commonly used software to run a self-hosted Matrix instance. The point of this exercise was to understand things, not just to grab the most popular thing. A little deeper dive (still in the kiddie end of the pool) revealed that Dendrite was the newer platform being developed (by the same team that created Matrix and Synapse).

While Synapse may have more mature features (in fact, more features in general), everything about the description of Dendrite appealed to me. It also felt more future proof (though few things ever really are…).

So, off I went installing Dendrite (which gave me a Matrix server). Now it was time to pick a client. Once again, down a rabbit hole of reading about many different clients. Ideally, I would pick one that was cross-platform between Linux and Android (not that they needed to be the same client).

After much reading, I decided to go with the most feature-rich one, which also happens to be built by the original Matrix team. It’s called Element.io (from now on, just Element). This was a slightly more difficult decision, since it’s also a business product (hosted, costing $$$). On the other hand, it’s fully open source, so just the service (hosting/managing) is paid for.

So far, I’m very happy with Element, so I think/hope I made the right decision (of course, switching is simple and non-destructive, another win for open/distributed services!).

Now the $64K question: is it useful?

I’ll answer that specifically for me shortly. First, a more generic answer…

Matrix has a number of general uses. The two most obvious are:

  1. Messaging (as in Instant Messaging like What’s App, iMessage, etc.)
  2. Discussion Groups (as in Slack, Discord, etc.)

Messaging can be fully encrypted end-to-end. The same is true for rooms (the Slack/Discord part). That’s particularly powerful, especially since it’s fully distributed (though you can lock a room to only local participants). You can allow users to register to a Matrix server openly (and verify them or not), or you can lock your server and easily manually add users as the administrator.

So, a big advantage of Matrix over the myriad (excellent) proprietary systems out there is that no big tech company needs to be trusted with your communications.

Of course, I had no illusion that everyone I communicate with would flock to a new system and bring over all of their contacts as well. In fact, I assumed that I might never have a real conversation with another human over Matrix ever (and that still might end up being true, but who knows…).

To repeat, I installed this more as a technical experiment and to understand the possible use cases, not as a replacement for anything I’m currently using.

That said, I’d be very happy to use it if anyone I knew was interested, since it’s very snappy on the web, on a Linux client and on Android. I’ve never used Slack or Discord (I’ve come ever-so-close to signing up with Discord a number of times), and I’d be happy to use the rooms feature of Matrix as well (if I had a use for it, which I do, but not the way most people do!).

Now to finally answer the question is it useful specifically for me!

Yes, immediately, and in a pretty impressive and delightful way!

What follows may seem like a meandering digression (my typical trademark), but it’s actually important background to understanding why I’m really happy with this setup.

First, there are two versions of Element for Android. One is available on the Google Play Store and uses Google APIs and services to push real-time notifications to the app on your phone. The second is a version that is fully open source compliant, available on F-Droid (an open source alternative app store). Programs on F-Droid are not permitted to use Google Services, since that would include a non-open source component in the app.

If you install the F-Droid version, you don’t get push notifications through Google. There are a number of alternatives. The simplest (and least efficient) is to allow the Element client to poll for new messages (on whatever frequency you set). This can be a big battery drain if you set it to poll frequently. But, there are also alternative notification receivers (so that at least only one service on your phone needs to be waking up) and it can pass the notification on to your app (in this case, Element).

Since I use Google Services for tons of things (not that I trust them, but hey, there is a ton of value for the trade-offs I’m making), I was happy to install the Google Play Store version.

But why do I care? I previously said that it’s quite possible that I’ll never have a conversation with another human Matrix user ever! The key word in that sentence is human. Matrix has an API so that programs can communicate with it (bots, and one-liners as well). I don’t need to have a conversation with a program that I write (though there are some really cool uses for that as well!), so what’s my interest?

It’s not terribly difficult to write a program to use the Google API to push a notification to your phone. I’ve never done it, so it might sound arrogant to say so, but I’m pretty sure I’m right. So what’s so different here?

First, and probably least important, is the built-in end-to-end encryption. This isn’t critical, as you can probably encrypt messages before pushing them through Google, but hey, you get it for free using Matrix.

Here’s the really important one (to me!). I have two phones (a primary and a backup, but I use the backup for certain things every single day). I have a Chromebook. I have a Pixel Watch. If I get a notification for an app that is installed on all of those devices (in the case of the watch, the notification will be mirrored from my primary phone even if the app is not installed on the watch), then all four devices will show the notification at the same time. So far, so good…

But, depending on the app (specific examples are Calendar and Tasks, both Google apps!), once I clear the notification on one device (either by swiping it away, or by tapping it to display the app), the notification will still be displayed on the other devices. This is highly annoying (except for the 1% of times when that turns out to be useful

With Element, once I view the message in any app (including the web) on any device, all of the other notifications instantly disappear (the way it should be!).

So, how do I make use of this? I have eight servers that I maintain that run 24×7. I created a room on my Matrix server called PushNotifications. I created a new user on that server called pusher (how imaginative). I have a small Python program that lives on each server (it’s 100% identical on each server). The program takes a single argument of message. When run, it appends message to its own hostname (so that I can instantly identify which server sent the message).

When something happens on any server that I want to be notified about, that small Python program will be executed with whatever message I need to know (some service is down, something cool just happened, the server became sentient, etc.). All of my devices will instantly get the alert. Whatever device I happen to look at first will automatically clear the notification on all of the other devices.

If I change the Python program into a bot (something I might do in the future), then the reverse could happen as well. I could easily send commands to a server via Element/Matrix,  the bot would get the message and perform some function on the server or return some data, etc.

Even without ever communicating with another human over Matrix, I am already finding it very useful. Anything in the future will be gravy (nearly free gravy!).

OK. If you got this far, and happen to be a Matrix user, and happen to know me, feel free to message me there. You can find me at:

@hadarvc:matrix.opticality.com

If you know me, and want to try Matrix out, feel free to ask me for a login on my server (it’s not open for registrations, but I’m happy to create an id for you. The service is distributed (federated), so you’d be able to communicate with other Matrix users even if they aren’t on my server, and you can join public rooms (many of which are hosted directly on matrix.org).


Posted

in

, ,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *