Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I kind of agree with you, but I'll add that XMPP usage of XML is weird enough that it makes it hard it use a normal XML parser / producer. Honestly I really wanted to like XMPP. I read all the specs at the time, even started to write some code, but all I can say is that it really sucks. I haven't looked at matrix yet, I hope it's better


Indeed! I was in the same boat - also started writing a client, but wasted too much time on the stupid XML stream idea.

Basically, chatting is message oriented, but the XMPP inventors thought it would be neat to start the connection with a tag like <beginconversation> which would then be dangling for the whole connection, preventing the use of a simple DOM XML parser (remember this is many years ago) for each message.


Any XML parser that I know can parse XML in a stream, that's all you need to handle an incoming XMPP stream.

Just an example, here is the XML parser that I wrote in PHP https://github.com/movim/movim/blob/master/lib/moxl/src/Moxl... (127 lines), it basically handle the stream as an input and fire SimpleXML (can also be DOM XML) on the other hand.

This can handle thousands of XMPP messages (called stanza) per second :)


Can it handle plaintext XML suddenly becoming TLS encrypted? Because that's also what happens on any XMPP connection. If it can, then great but I guess it's more an exception than the rule


fwiw, in Matrix, to send a message, it's:

  curl 'https://matrix.org/_matrix/client/r0/rooms/!RXNcERlITUVszBNIPW%3Amatrix.org/send/m.room.message/123?access_token='$TOKEN -X PUT --data '{"msgtype":"m.text","body":"hello world"}'
and to receive messages it's:

  curl 'https://matrix.org/_matrix/client/r0/sync?access_token='$TOKEN
Hopefully this ends up being quite easy to work with :)


and for XMPP

    <message to="user@server.com"><body>Hello world</body></message>
No need for a token, the socket you're in is already authenticated :)


Also flexibility can be good but XMPP is way too modular.


You don't have to implement all the modules :p There is some basic ones that you need (see XEP-0412: XMPP Compliance Suites 2019 - https://xmpp.org/extensions/xep-0412.html) and you have already an up to date client and server. The rest if for specific use cases.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: