Lead A Discord Exodus With A Matrix Server

The Internet, and large groups of people in general, tend to have a remarkably short collective memory. Whether it’s the nature of algorithms or the people themselves to always be chasing the next novelty, maintaining long-term engagement for even relatively small changes can be challenging. Distractions abound, and motivation tends to fade over time. This past spring, Discord’s unpopular decision to force age verification resulted in a brief flash-in-the-pan of outrage that dissipated when they promised to delay its roll-out. Rather than backtrack on unpopular policies, they’ve been slowly boiling the frog with incremental changes towards this same goal in the meantime. One of the options to deal with this is to migrate over to something like a Matrix server, which has a number of benefits over Discord including being open-source and self-hostable.

Unlike Discord, a closed platform subject to the whims of a private company, Matrix is a communications protocol and open standard. Its major server and client implementations are open source, so anyone can build tools around it and integrate it with other systems that also use this protocol. This protocol-vs-platform comparison mirrors email, which is another protocol that isn’t locked down by any one company, and which can easily be used to send messages across various providers. The most commonly used server-side software for Matrix is called Synapse and the most prominent general-purpose clients are the various implementations of Element, and my exploration uses these defaults.

Analysis Paralysis

One of the problems with choosing a Discord replacement for one’s family, friends, or online gaming community is that there are a huge number of options. In much the same way Linux itself fails to make a dent in the desktop operating system market, open-source and community-driven projects are relatively easy to code and release but difficult to market and build up a sustainable userbase. So, while there are platforms like Stoat, XMPP, and others which provide self-hosted text and video communication, many of these services have a very small userbase or have some other shortcoming, and on some deeper level it can feel like flipping a coin to choose between any one of them and their myriad of forks.

For me personally, my choice of Matrix over any other option was partially driven by the fact that it seems to have an active and helpful userbase compared to others, it has it has strong end-to-end encryption support which is generally enabled by default (for private chats), and it’s possible to host on computers that I own. Another big reason I picked Matrix to experiment with is that self-hosting Matrix is optional. There is a large and active server called matrix.org that functions as a default server of sorts, which allows almost anyone to sign up and start chatting without having to install anything other than a Matrix client like Element. In this way, matrix.org feels a lot like IRC in its golden age because these large servers allow mostly anonymous Internet users to communicate about various topics in dedicated chatrooms without any great effort.

Federation Is Also Optional

Matrix is often loosely lumped in with other “federated” social media like Lemmy or Mastodon because, like these ActivityPub-based systems, there is no central server like Discord or Reddit and no overarching authority policing the entire network. So a Matrix server can federate with other Matrix servers, allowing users on the two servers to participate in the same rooms and exchange messages. If one server goes offline or decides to defederate for whatever reason, that doesn’t bring down the rest of the network, although users and rooms hosted exclusively on that server will of course be affected. Federation is also optional, and independent servers for one’s own family or friends that don’t federate with any other server is just as possible as a large server federating with all of the major servers like matrix.org. Compared to Discord, this decentralized structure makes it much more robust to a single entity’s whims.

Although a different protocol from ActivityPub which is used for other federated social media, Matrix also has a bridging network that allow it to communicate with other platforms, including IRC and Discord, as well as numerous other messaging services. So, in theory, setting up a Matrix server doesn’t preclude anyone’s friends on Discord from communicating with them, and might make it easier to migrate a friend group to the more open platform over a period of time, rather than expecting everyone to pick up and move all at once.

Starting The Virtual Machines

To that end, setting up a Matrix server does take a little more effort than creating a channel in Discord. I have a Proxmox server that makes setting up new servers relatively easy, but the server- and client-side software runs just fine on most Linux distributions without the help of virtualization. To start, I spun up an LXC container to run Synapse which is easy enough, but only includes text and photo chatrooms on its own. I was able to make this available on the wider Internet using a Cloudflare tunnel at first. With the Cloudflare URL, encryption keys, and the Element clients on various machines owned by my family and friends, everyone was easily able to get in to the chat rooms and communicate, with full end-to-end encryption and with messages stored on a machine I physically control. If you’re following along and want to stop here with just text-based chat, that’s certainly a viable and simpler option.

However, this does fall short of matching Discord’s quick voice and video calling, and this is where Matrix server administration can start to get a bit cumbersome. The short story here is that, at the time I set up my servers, there was a legacy calling mode alongside a newer one, so to support both there were two additional servers that needed to be set up. The legacy mode needs a TURN server, and the modern voice and video calling system supported by Element generally needs a LiveKit server. Since I set up my servers, though, this architecture has been simplified with TURN becoming less central to typical Matrix servers.

The next hurdle for me was getting around my Internet service provider’s network address translation (NAT). This is part of the reason I started using a Cloudflare tunnel in the first place, but the free tier is basically only an HTTP/WebSocket proxy which has no way to accept the UDP connectivity that TURN and LiveKit normally require for media. To solve that problem I turned to a small VPS that I rent which has a public-facing IP address. (I actually put an OpenOSCAR server on here first, back when this project got popular, to test out its capabilities and get it ready for my Matrix server.) The TURN server is lightweight enough to run on the VPS directly, but LiveKit is much more resource-intensive than I’m willing to pay for. This means LiveKit has to run on my server, so I set up a WireGuard connection from the VPS back to its container on the Proxmox machine.

Part of what makes this setup a little more difficult than average, besides the NAT-induced headaches, is that even once these packets get to my router, which is also hosted on my Proxmox machine, they go to a DMZ on a separate VLAN in my home network so that public-facing traffic can never get through to the rest of my LAN. But that DMZ includes a number of other public-facing services which are managed by an nginx server, adding yet another layer to this onion of a system. So between the support services for the Matrix server, the network layers, the off-site VPS, and the Matrix server itself, my setup involves six virtual machines, some interaction with Cloudflare, and one additional (albeit relatively inexpensive) paid service. This also doesn’t count the services I run on the Proxmox host and in other VMs to monitor web traffic and improve network security.

Even this setup, once I spent a considerable amount of time troubleshooting, has its downsides. For some reason which still eludes me, users on iPhones running the Element X client are randomly unable to send picture messages to chats. Occasionally a service on one of my many VMs will fail and need maintenance, and this seems to only happen when I’m not near my laptop. But perhaps most notably is that my Matrix server still doesn’t federate with any others. This isn’t really a problem as much as it was a conscious choice, though; it’s something that’s possible with a public endpont of some sort, so it’s my VPS makes this an option for me, but I haven’t attempted it yet. Mostly this is because the people on my Matrix server that actively use it are family members who don’t need or want that kind of exposure to the deep Internet, and my broader experience on matrix.org was often marred by things like crypto scams and generally desolate chatrooms.

All of This Has Happened Before, and All of This Will Happen Again

If you’re still with us after that extremely convoluted journey, it might seem like this is a lot to ask to replace a free service that’s been fairly instrumental in making it easy for gamers to interact with each other over the Internet and which has also revolutionized online chatrooms (for better or worse). But they have demonstrated time after time that they’re willing to slowly erode user trust, privacy, security, and experience in favor of shareholder value, and as they start rolling out “features” like age and identity verification they introduce more categories of sensitive information that are stored somewhere, and more potential points of failure. Given the long history of major companies failing to protect user data, it seems inevitable that someone will eventually make a mistake and expose information that users never expected or wanted Discord to collect in the first place. So for those who still have intact memories of Discord’s prior attempts to implement extremely unpopular policies, or even memories of other companies who have failed to protect sensitive user information in the past, a Matrix server might be worth the attempt.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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