If you have ever used Matrix you likely came cross matrix.to
links. This service is hosted by the Matrix.org Foundation.
So, what are matrix.to
links?
Matrix.to
links exist to link to rooms, users and events and are specified in point 4.4.2 in the appendix of Matrix spec. They are being used everywhere to link to rooms (users and spaces, these things are just rooms with syntactic sugar at the end of the day). Most clients give you a matrix.to
link when sharing rooms, contacts or events.
What is the problem with matrix.to
links?
As you may have picked up on, there is exactly one server almost all clients and users rely on to link to Matrix rooms. This creates a central point of failure which can also easily be blocked by a third party, which goes against the principles that the Matrix spec set for itself:
“The principles that Matrix attempts to follow are: […]
- Fully decentralised - no single points of control over conversations or the network as a whole“
~ https://spec.matrix.org/latest/#introduction-to-the-matrix-apis
Is there a solution to that problem?
Yes, there is. In the form of Matrix URI scheme.
The Matrix URI scheme is registered with the IANA and is formally specified in point 4.4.1 of the appendix of the Matrix spec. It supports all the same attributes that the matrix.to
scheme also supports and is understood by all major web browsers and most Matrix clients while not creating a single point of failure.
Funnily enough the matrix.to
website actually links to rooms using the Matrix URI scheme for most clients they offer links for, so why not just cut out the middleman.
But what if someone doesn’t have an account or client?
Counterpoint: why does everyone need to be directed to the matrix.org
homeserver? That also goes against the principles Matrix set for itself. Matrix has gotten to a point where it is really easy to find a client with a single web search and if that isn’t enough there is also https://matrix.org/ecosystem/clients/ which could be linked to. Example:
Find me on Matrix: @famfo:ccc.ac
Find me on [Matrix](https://matrix.org/ecosystem/clients/): [@famfo:ccc.ac](matrix:u/famfo:ccc.ac?action=chat)
My web browser or client doesn’t register a link handler!
File a bug report with your client and copy the user ID / roomID and paste it into your client manually.
Is it really necessary to point people to a central middleman for matrix URIs if the alternative is to add another link yourself? So: please use the Matrix URI scheme instead of matrix.to
links
Examples of such links:
#<room_name>:<homeserver_domain>
:matrix:r/<room_name>:<homeserver_domain>?action=join
#foo:example.com
:matrix:r/foo:example.com?action=join
@<user_name>:<homeserver_domain>
:matrix:u/<user_name>:<homeserver_domain>?action=chat
@alice:example.com
:matrix:u/alice:example.com?action=chat
!<room_id>:<homeserver_domain>
:matrix:roomid/<room_id>:<homeserver_domain>/e/<event_id>?via=example.com
!foobar:example.com
:matrix:roomid/foobar:example.com/e/1234abcdef?via=example.com
For more examples and a formal definition, see the specification: https://spec.matrix.org/latest/appendices/#matrix-uri-scheme
Element and others are not helping the case
I said most Matrix clients support the matrix URI. Well only most. Element doesn’t actually register a matrix URI handler with the OS, only an internal one for element
URIs which I couldn’t find documentation or any references for. SchildiChat just did s/element/schildichat
for that URI, with again, no documentation.
The fact that most clients are creating matrix.to
links for rooms, events, etc. is also an issue because I don’t think a lot of people actually know about the matrix URI scheme.
Edits
22.06.2024: add paragraph about clients not registering the matrix URI scheme with the OS