I second the sibling comment recommending XMPP. Take a mature server like ejabberd, set up your DNS and firewall, and you are good to go. Easy, secure, extremely reliable and scalable.
Matrix problem statement/what it set to do differently is "rooms should survive their server going down". Although nice-sounding, it's never realized in practice: your server going down means your account is unavailable too, and you can't use the network. Rooms syncing is essentially "old IRC net splits" with more steps (and much more RAM/CPU). This way of tackling this sort of "high availability" at the protocol level makes implementing the Matrix spec impossible (there is only one almost-compliant server implementation to talk with almost one feature-complete client, all by the same entity, selling it as opencore). Now compare that with the half dozen or so well-maintained XMPP servers (and plethora of clients), most of which support a form for HA/resilience that happens at runtime-level instead of protocol-level (via Erlang clustering/distributed JVM). In other words, if that's what you care about, XMPP implements Matrix mission statement better, more efficiently and with less organisational centralisation than Matrix.