Take a look at Riot.IM (disclaimer: I’m a contributor to the project).
Behind it sits Matrix, a distributed signalling platform also capable of messaging. You can use the already deployed infrastructure, or deploy your own homeserver if that’s your game.
Also keep in mind that it’s under active development, and although the documented API is stable, new features might get added any time.