Leave messages in Synapse logs with typing EDUs
this is how to really communicate on matrix.
this post kind of requires prerequisite matrix knowledge, but i’ll try to explain things.
basics
EDUs and PDUs
if you don’t know about matrix you probably thought, “what’s an EDU?”
well, matrix has two basic units of data. the Persistent Data Unit, which carries timeline events like your messages, or room state like the room name and members. basically, the things that persist.
then there’s the Ephemeral Data Unit. things like presence, read receipts and typing notifications are EDUs. they’re not persisted by servers and as such aren’t stored anywhere.
even if don’t know much about matrix, EDUs are far easier to craft than PDUs.
transactions
how do these get across the federation? they’re batched in transactions. when a server wants to send stuff somewhere1. up to 50 PDUs and 100 EDUs (TODO: bullshit numbers please fill them in) get sent to a server per transaction.
great, now you know the key concepts behind this. not everything, but two useful things.
synapse logging EDUs
so let’s say we send a transaction to synapse with a typing EDU (m.typing), with a bogus room ID that the server definitely doesn’t recognise:
{ txn here }
what happens is this:
synapse logs here
it went, “wait, this isn’t even for a room i’m in” and logged it. isn’t that cool?
what if we send multiple EDUs, each with a more funny choice of room ID… like lines of ASCII art?:
logs
making the server
this is pretty easy because i use [mautrix/go]. its federation package includes a key server, federation client.
you can find the code here: https://git.squarebowl.club/plate/m3
-
most of the time, i think. actions like invites, joins, leaves or knocks have their own endpoints ↩︎