-
Sam
I don't think I realized that all the major clients written in python seem to use different libraries. Debating whether it's most beneficial to test against nbxmpp (so that I effectively have integration tests with Gajim) or something else. What other popular clients is it most beneficial to ensure compatibility with?
-
moparisthebest
don't all non-trivial XMPP clients use their own libraries ?
-
Sam
It really does seem so
-
Sam
I guess I shouldn't have been suprised by this; I think I knew what all these used, it had never really hit me though.
-
moparisthebest
even if they don't start out that way, seems like they always end up that way...
-
Sam
I'd love to know why that is; I wonder if it's something about the protocol or something about the size of the community that uses it, or the type of people, etc.
-
moparisthebest
I only have conjecture... almost all XMPP libraries seem massively over-engineered to the point that you can only use them in a very specific way
-
moparisthebest
making them unsuitable to use in a real non-trivial client with even slightly different needs
-
Sam
Oh, how so? I haven't found that to be the case with aioxmpp or slixmpp which are pretty much the only two I've used outside of my own thing or "libraries" that are built into clients and so are obviously tightly coupled
-
moparisthebest
a common pattern I've seen is needing to "register" another "class"+deserializer+serializer for every even slightly different stanza type that might exist
-
Sam
As opposed to just being handed a generic representation of the XML, you mean?
-
moparisthebest
because the library insists on being XML library independent, and/or pretending stanzas are objects and not XML, that kind of thing
-
moparisthebest
well, at least having that option yea
-
Sam
I dunno, it seems like you'd have to do that otherwise you'd have to dig into some arbitrary deeply nested thing and figure out what it is every time. Registering a callback for "normal message with body" or something seems like it would make the users life easier.
-
moparisthebest
right, it's always "well why would a user of a library ever need to do this? it would be so much easier to do it the-way-i-have-in-my-head" and that never ends up matching with someone's GUI library or whatever
-
Sam
Now that you say that, I did design Mellium specifically to allow "just give me a stream of XML and let me do things with it" too, specifically so that you could write your own router/handler thing. But it doesn't seem unreasonable to just require callback.s
-
moparisthebest
yea, I really think the solution is layers, where the library user gets to pick which layers they want
-
moparisthebest
1. connect TLS 2. raw stream 3. separate xml stanzas 4. objects or whatever 5. some type of state management
-
moparisthebest
the XML libs I've seen don't let you go lower than 4 ever, and normally not 5
-
Sam
That's exactly how Mellium works, but FWIW it doesn't always end well either. I can't think what off the top of my head, but I know we've had a few things where we want the connection dialer to know about TLS or something, but they're separate and it's a problem.
-
moparisthebest
it's certainly not an easy solution or it'd already be solved hehe
-
Sam
huh, even the javascript clients seem to use different libraries. Pretty sure this client and this other library are maintained by the same person and the client does its own thing and doesn't use the library (or I'm just misunderstanding JavaScripts many config files, which is more likely)
-
moparisthebest
the 3 problems of computer science, naming, cache invalidation, off by one errors, and the perfectly designed universally used XMPP library
-
Sam
Anyways, turns out it's harder than I expected to pick what the best thing to test compatibility with is. Also the situation in terms of re-usability is more dire than I thought. I am not sure if there are any useful conclusions to draw here or anything useful to do.
-
moparisthebest
unfortunately I think the conclusion is not what you want to hear
-
moparisthebest
it's "don't bother writing a generic XMPP library, no one will use it for anything non-trivial"
-
moparisthebest
useful for a sendxmpp clone or a bot, not for a client though
-
Sam
I'm not sure that's the conclusion; I think the conclusion is "do write a generic XMPP library if one doesn't already exist in your ecosystem of choice, but if one does exist use and improve it in your client instead of writing a builtin tightly coupled one"
-
moparisthebest
could be, but then you'll end up maintaining it, that seems to be what happened with nbxmpp and gajim
-
Sam
If you follow the advise then hopefully other clients show up to help you maintain it though, even if it becomes abandoned and one of the client devs has to pick it up.
-
Sam
But yah, I really don't know how to encourage that kind of participation.
-
Sam
Maybe it's a problem of discoverability too. I probably wouldn't have started Mellium if I realized there was another library already in Go (not counting the one that most people use which is little more than a Google Talk bot framework, you can't use it for serious work). I looked and never found the FluxxIO one and it was a few years before I realized that it had already been a thing.
-
moparisthebest
I really think it's just a GUI thing
-
moparisthebest
writing a GUI XMPP client is 9999x harder than writing a server or a library or a command line sendxmpp
-
moparisthebest
and the assumptions all of us who avoid GUI code like the plague make are just wrong when it comes to writing GUI code
-
Sam
I'm not sure that's true, but I definitely don't write a lot of GUI code, so it's quit possible that I'm doing exactly what you're describing. But I don't see why it would be any easier or harder to write Gui stuff with slixmpp vs. nbxmpp vs. aioxmpp, for example (other than difficulties that would apply to anything due to one or the other library generally being harder or easier to use for various reasons, but I don't see what would be specific to GUI stuff)
-
moparisthebest
Sam, have you ever written GUI code and if so what kind?
-
moparisthebest
I have, but long ago, and Java Swing, and I still have nightmares haha
-
moparisthebest
I'm not counting html/javascript I guess...
-
Sam
Oh yah, I've done a decent bit of GTK, some Android stuff, a bit of web stuff, some immediate mode custom GUIs, some TUI stuff. I don't like it much, and avoid it, but I have done it.
-
Sam
I vaguely remember being forced to memorize various Swing APIs in some terrible intro to CS class in college, but I don't think I ever wrote anything with it after that.
-
moparisthebest
oh yea I've done some old android GUI too but also remember it being terrible
-
Sam
Yah, it's pretty bad.
-
Sam
I don't see how a specific library would necessarily be better or worse with it though.
-
qy
Android is nicer now. Try androidx compose
-
qy
No need even for xml
-
moparisthebest
but I like XML !
-
qy
Then you should try xmp-wait
-
qy
Xml i think is the wrong form for android uis, but meh, it does work
-
qy
Compose really is aeons better though, no wonder google absorbed it
-
Stefan
Sam: I have been worked on a generic framework for XMPP. The biggest problem for me: it's not such easy. 😬 Lot of things you have to keep in mind to keep it reusable and flexible.
-
Zash
It's almost like there are two kinds of libraries: Those used by exactly one client, and those used by random stuff but no clients.
-
moparisthebest
Zash: exactly what it seems like yes
-
Zash
Smack might be the exception?
-
Zash
Unless whatever Yaxim uses counts as its own library by now 🙂
-
qy
Zash: libstrophe?
-
Zash
Which one? Which clients?
-
mathieui
Zash, slixmpp begs to differ :p
-
Zash
:doubt:
-
Zash
Make directed graph plz.
-
qy
Libstrophe used by profanity, and my weechat client, as well as i think at least one other?
-
qy
Also TIL xep 174
-
qy
Neat