-
jonasw
anyone here at whom I can bounce an idea I had for ecaps2?
-
jonasw
(otherwise I’ll take that to the list, but from experience, I won’t get a lot of feedback there :/)
-
Zash
How much context is needed?
-
jonasw
if you know how caps (XEP-0115) works, it’s probably fine
-
Zash
How much coffee is needed? :)
-
jonasw
uh, maybe a bit, but I’m not sure. I don’t drink coffee :-)
-
Zash
Shoot. What's the worst that can happen? :)
-
jonasw
ühah✎ -
jonasw
hah ✏
-
jonasw
so I was wondering what if we don’t have clients inject the caps into the presence, but instead use a nonza/stream-level element to let the server know about the caps.
-
jonasw
the server would then re-send presence and take care of injecting caps updates in presences.
-
jonasw
receiving entities would see the caps in presence as usual.
-
jonasw
this saves the client from re-sending (non-directed) presence when the caps change (server would re-broadcast)
-
jonasw
I literally just had the idea. I’m not 100% sure how the interaction with stream management would be.
-
jonasw
(but probably it would be "re-send your caps to the server after resumption, unless you’re 100% sure your previous caps update came through")
-
jonasw
the rationale why this might be nicer for the client is that presence is already a rather complex beast, in the context of MUC, in the context of vcard avatars and possibly other things (if we want to integrate chat states into that for example)
-
Zash
You could transmit your entire disco#info blob, then the server could do the caps/ecaps/magic for you
-
jonasw
very interesting point
-
jonasw
and do all other sorts of interesting things with it even
-
jonasw
(e.g. what people proposed with publishing a subset/superset of all client features in a PEP node)
-
Zash
Would probably tie in nicely with some future client registration
-
jonasw
client registration?
-
jonasw
like, device keys?
-
Zash
The server having some idea of which clients you have.
-
jonasw
yes
-
Zash
Sounded like people wanted something in that direction.
-
Zash
jonasw: I think we should be careful with just throwing non-stanzas at everything
-
jonasw
an IQ would work just as well here
-
jonasw
(I actually put some thought into nonza vs. message for server-originated pushes and there nonza was fine and semantically made more sense, so I just transferred that to client-originated pushes too; I might be wrong here)
-
jonasw
(I’m not sold on using nonzas)
-
Zash
Caps are a property of what, exactly?
-
jonasw
the client.
-
jonasw
(or server respectively)
-
jonasw
(entity.)
-
Zash
Not the stream itself.
-
jonasw
yeah
-
jonasw
probably makes sense to put them as IQs or something
-
Zash
I was thinking basically just disco#info in an iq-set would be nice and simple
-
jonasw
yeah
-
jonasw
so clients wouldn’t have to calculate *their own* hashes anymore, but they might still want to calculate other peoples hashes and keep a cache.
-
jonasw
for directed presence, sending an "empty" directed presence would make the server inject caps as needed. is that a privacy issue?
-
jonasw
probably not, because who knows your resource can disco#info you anyways.
-
Zash
yup
-
jonasw
cool
-
jonasw
I hear a namespace bump rolling along.
-
jonasw
or maybe not.
-
jonasw
gotta think about that
-
Zash
New namespace, disco#push or something?
-
jonasw
nah, I need to think whether caps2 itself needs a bump for this. But it might actually not.
-
Zash
Does ecaps2 replace disco?
-
jonasw
no
-
jonasw
not entirely I think
-
Zash
caps is a separate thing right
-
jonasw
it might save you a lot of disco#info-ing, but you still need to support xep-0030
-
jonasw
and then I’ll need to make an implementation in prosody to show that it works :D
-
Zash
PoC all the things!
-
jonasw
maybe I’ll sink my afternoon in that.
-
Ge0rG
jonasw: awesome idea, I'm all for making the client dumber again
-
Ge0rG
jonasw: beware directed MUC presences though, they are broken already.
-
jonasw
Ge0rG, what’dya mean?
-
jonasw
server wouldn’t resend directed automatically, client needs to do that (server just injects caps hashes)
-
Ge0rG
jonasw: I _think_ I sent that to standards recently, but can't find. When the MUC changes your nickname, your server will later send your "directed" unavailable presence to the old nickname.
-
jonasw
yeah, heard about that
-
Ge0rG
jonasw: shouldn't the server resend all directed presences on a caps change?
-
Zash
Yeah, the MUC changing your nickname causes all sorts of headaches
-
jonasw
Ge0rG, I looked at how {xep 0398} does it, and it doesn’t resend directed either
-
Bunneh
Ge0rG: User Avatar to vCard-Based Avatars Conversion (Standards Track, Experimental, 2018-01-25) See: https://xmpp.org/extensions/xep-0398.html
-
Ge0rG
jonasw: maybe it's just an oversight by the XEP authors?
-
Ge0rG
it would make sense to resend.
-
jonasw
maybe; we should ask daniel about this✎ -
jonasw
maybe; we should ask daniel about this ^ ✏
-
Zash
jonasw: Nothing says you can't have the server query disco#info like normal and then generate caps and ecaps2 for it.
-
Zash
For legacy clients etc
-
jonasw
Zash, true; I’m not sure why you’re mentioning that though.
-
Zash
Thinking out loud
-
jonasw
(and it would require polling)
-
jonasw
ok
-
Ge0rG
it would add some nastyness into the protocol flow
-
Zash
Prosody already does it, but discards the response, save for the PEP +notify items
-
Ge0rG
1. client sends online presence 2. server delays outbound presence, asks client for disco#info instead 3. the client sends directed presences all around 4. eventually, the client responds to disco#info 5. the server can now inject and forward
-
Ge0rG
is +notify part of disco#info?
-
Zash
Ge0rG: Yes
-
Ge0rG
Zash: which question was that a response to?
-
jonasw
I wonder if we should be stripping +notify from things sent to peers while we’re at it.
-
Zash
Ge0rG: +notify goes in disco#info
-
jonasw
but probably not.
-
Zash
Can we forklift PEP into being account based that way?
-
Zash
As in, subs are between accounts, not between remote account and specific resources
-
Ge0rG
wasn't there a discussion of making PEP account-based just some days ago, on this MUC?
-
jonasw
I must’ve missed it
-
jonasw
Zash, it could be a good first step with the superset thing
-
jonasw
would probably require an update to {xep 0163}
-
Bunneh
jonasw: Personal Eventing Protocol (Standards Track, Draft, 2010-07-12) See: https://xmpp.org/extensions/xep-0163.html
-
Ge0rG
Zash: what's up with Bunneh? I'm missing it sorely.
-
Zash
Bunneh: ping
-
Bunneh
Zash: pong
-
Zash
Bunneh: version Ge0rG
-
Bunneh
Zash: Ge0rG is running yaxim version 0.9.2-95-gcab21a3 on Android
-
Ge0rG
That's a lie.
-
jonasw
Ge0rG, your statement is confusing to me: https://sotecware.net/images/dont-puush-me/v7RTW5gsnGjnTE5G6QahCIPsruzqV3-1IRISifpDBRI.png
-
Zash
Ge0rG: Stanza reply id duplication causing you problems?
-
Ge0rG
Zash: it won't join my MUC.
-
Ge0rG
jonasw: why are you quoting by image? :P
-
jonasw
Ge0rG, that is a very good question I can’t really answer
-
jonasw
I guess that’s what happens when you have a scrot-scp-xclip pipeline bound to something which is close to a hotkey
-
Ge0rG
I don't even want to know what "scrot" is the abbreviation for.
-
jonasw
Ge0rG, it’s not an abbreviation, it’s the name of a tool.
-
jonasw
I find it confusing, too.
-
Ge0rG
that's what she said?
-
jonasw
cf. http://manpages.ubuntu.com/manpages/precise/man1/scrot.1.html
-
jonasw
argh
-
jonasw
I’ll just head out now :P
-
Zash
Ge0rG: I'm going to guess that it thinks that it is joined. Or doesn't support mediated invites. Or both.
-
jonasw
see you later
-
Ge0rG
Zash: can't you kick its lazy bottocks?
-
Zash
I can update its server
-
Ge0rG
If that will make it rejoin my MUC?
-
Zash
Setting up prosody-trunk (1nightly844-1~trusty) ... prosody stop/waiting prosody start/running, process 1714
-
Ge0rG
When doing disco#info on my own server, how am I supposed to differentiate a MUC service from an IRC transport?
-
Zash
Are you supposed to at all?
-
Ge0rG
I'm sure it won't end up well if I try to create a private MUC on biboumi.
-
Zash
Uh, fun
-
Ge0rG
Wasn't there a disco#info item telling a client that it may create new MUCs on that service?
-
Zash
I'm not aware of such a feature
-
Zash
Not that many features depend on who asks
-
Zash
Or?
-
Ge0rG
...that it is possible to create new MUCs on this service.
-
Ge0rG
XMPP is full of fail.
-
Zash
You could look for the feature "http://jabber.org/protocol/muc#unique"
-
Zash
It's pretty useless tho
-
Zash
It would imply that it's possible to create randomly named MUCs... for someone... maybe
-
Ge0rG
Zash: that's not part of 45?
-
Zash
-xep 307
-
Bunneh
Zash: Unique Room Names for Multi-User Chat (Standards Track, Deferred, 2011-11-10) See: https://xmpp.org/extensions/xep-0307.html
-
Zash
It was broken out IIRC
-
Zash
The Prosody implementation just returns an UUIDv4
-
Ge0rG
Ah, it's type=irc as opposed to type=text. Yay.
-
Zash
How is irc not text?
-
Zash
And how do you know that room creation is not restricted to admins?
-
Ge0rG
I can't.
-
Ge0rG
I can't fix all problems of XMPP. Not today.
-
Maranda
It's all an iconian plot I tell you. 🙄🖖
-
mathieui
Ge0rG, but you have to
-
Ge0rG
mathieui: maybe if somebody will pay me.
-
Guus
Ge0rG: do you accepty payment in the form of stickers?
-
Ge0rG
Guus: I'll ask my landlord.
-
Ge0rG
TBH I never considered putting stickers onto my Laptop, my car or any other item. Not sure why.
-
Guus
Ge0rG: Cut out the middle man! Stickers make for nice decoration for inside a cartboard box under a bridge!
-
Guus
Ge0rG: same here.
-
Ge0rG
Guus: great idea! But living under the bridge isn't free either.
-
Zash
Extract tolls from passing goats?
-
Ge0rG
I could probably obtain sufficient amounts of food by dumpster diving. But how should I handle the -5°C temperatures
-
jonasw
Ge0rG, mine bitcoin on your laptop
-
jonasw
oh wait.
-
Guus
I like how we as a community are coming together to tackle both Ge0rG's residential issues as well as all of XMPPs problems.
-
Ge0rG
Guus: I'm very grateful for that effort.
-
Ge0rG
,oO( does "being grateful" actually mean "being full of grates"? )
-
Kev
Full of gratitude, I think, but your understanding could be good too.
-
Ge0rG
In that case I prefer to be gratitudeful, thanks.
-
Zash
Hmm, gratäng?
-
flow
jonasw, I'm not sure if client implementations would become easier. As far as I remember, implementing caps in Smack was not really challenging.
-
flow
besides the i;octet collation, which is possilby underspecified in xep115 (but thankefully not in xep390)
-
Zash
I would be happy if, when I use `clix raw` and send presence, it doesn't instantly drown in so many disco#info queries and other stuff that the terminal crashes.
-
Zash
(rlwrap doesn't always handle syntax highlighting all that well)
-
flow
Are there so many implementations that fetch disco#info unconditionally after a caps update? Are impls supposed to do that?
-
flow
Zash, what's clix?
-
jonasw
Zash: thats separate though, we can have query interception as-is
-
Kev
Command-line XMPP.
-
Kev
But yes, I'd expect clients to disco when they see a new caps.
-
flow
Why?
-
Zash
flow: http://code.matthewwild.co.uk/clix/
-
Kev
To know what features are supported by contacts.
-
jonasw
flow: decoupling caps from presence has the advantage of being able to use caps without presence
-
flow
jonasw, is it really caps that you decouple, not disco#info?
-
Link Mauve
“15:54:05 flow> jonasw, what do you think about the xep390 optimization to move the disco#info result from the client to the server?”, I have an experimental module doing that for 0115, caching the disco#info and the 0115 node in the session table, and answering iqs requesting it automatically.
-
jonasw
and if we push disco#info and let the server deal with it, thats nice I think
-
Link Mauve
A few things to fix and it should end up in prosody-modules.
-
jonasw
also I'm on mobile
-
jonasw
gotta go
-
flow
Kev, but why do you need to know the features right after the caps update? And not, let's say, when you show the contact list in the GUI?
-
flow
Link Mauve, so xep115 § 8.4?
-
Link Mauve
flow, hmm, no, I don’t change anything about what the client advertise, I just request the disco#info when its <c/> changes and answer iqs from external entities instead of routing them to the user.
-
Link Mauve
I’m not sure what stripping it would achieve.
-
Link Mauve
Other than increase the amount of requests from other entities.
-
Link Mauve
And prevent them from using their normal cache mechanism.
-
flow
Link Mauve, sorry, I thought that was the xep115 counterpart of xep390 § 6.4 without closing reading it
-
flow
So you do xep390 § 6.4 for xep115?
-
Link Mauve
flow, yes, except I forgot the third point, will fix.
-
Link Mauve
I’ll add a mention of that.
-
Link Mauve
And soon will add support for 0390 too.
-
jonasw
Link Mauve: sweet! what do you think of the proposed model of pushing disco#info from clients?
-
jonasw
so that the server handles hash calculation and presence broadcast?
-
Link Mauve
jonasw, would avoid one roundtrip, but it would also require every client to change, so I’m not sure it’s really useful.
-
Link Mauve
Well, both clients and servers.
-
jonasw
Link Mauve: we need to change clients for 390 anyways 😺
-
jonasw
(and servers)
-
Link Mauve
Uh, why?
-
Link Mauve
I just had the idea to let the server compute 0390 and insert it in the presence if the client only had 0115.
-
jonasw
Link Mauve: because they need to emit/process 390 hashes instead of / in addition to 115 hashes.
-
Link Mauve
That would immediately increase adoption and usefulness.
-
jonasw
yeah
-
jonasw
indeed
-
jonasw
I'm working on an update to 390 btw. I'll add that.
-
Link Mauve
So I’ll continue this Prosody module in that direction, and you fix all of the clients in the meantime. :)
-
jonasw
I won't fix pidgin 😼
-
Ge0rG
jonasw: but you could burn it with fire.
-
jonasw
Ge0rG: having the server re-send directed presence to MUCs also has interesting isszes with the proposed no-join (since errors need to be handled) and possibly passwords etc.
-
jonasw
I think thats a can of worms I don't want to open.
-
jonasw
gotta go agaib
-
jonasw
*again
-
jonasw
re
-
jonasw
Link Mauve, so, others (I think the MIX folks) have already indicated interest in pre-presence disco#info from the client. XEP-0390 actually already specifies that with an IQ (even though that IQ only carries caps instead of disco#info). the change would be to make clients always use the IQ instead of presence to send caps to their server (and the server takes care of injecting caps in presence and re-broadcasting non-directed presence when caps change)
-
jonasw
Zash proposed to change the IQ to actually contain the whole disco#info data instead of only the caps, which I think is neat. It allows the server to do all kinds of interesting things, like do the 115+390 optimization without having to ask the client for disco#info if it doesn’t have the hashes in the cache.
-
Zash
Wasn't there a proposal for rolling auth, resource binding and some session initialization into one transaction? Maybe something Kev or Dave talked about
-
mathieui
https://opkode.com/blog/xmpp-chat-badge/ this is neat (from jcbrand)
-
Zash
Now taking bets on how long it would take to make that as a prosody module
- Maranda math.random(100)
-
Maranda
Bunneh¡! 🤣
-
Guus
ah, we have that for user presence, but not mucs. That's a nice idea
-
Guus
I shall shamelessly copy that.
-
Kev
References to pubsub items. Thoughts?
-
Kev
We're about to allow references to FDP forms in Swift, so we want a reference to a pubub item.
-
goffi
Kev: I would like to reference pubsub items for mentions in blog post too
-
goffi
Kev: I though a super simplified xpath compatible syntax would be useful
-
goffi
+t
-
Kev
We could just do this as any other URI reference, pointing at the pubsub item, but if we did a specialist 'pubsub' reference we could also include the namespace.
-
goffi
Kev: URI is not enough, we need to know if we reference text or XHTML body
-
Kev
I don't follow.
-
intosi
goffi: for pubsub?
-
goffi
intosi: for microblog items
-
intosi
But that's pointing to stuffs inside a pubsub item payload, which is probably beyond what Kev;s intending here.
-
Kev
I'm talking about just pointing to a pubsub item.
-
goffi
intosi: yes it's pointing inside payload, that's why I'm mentioning simplified xpath
-
goffi
OK
-
goffi
so that's an other issue I'm talking about then.
-
Kev
I think so, yes.
-
SamWhited
Speaking of xpath, does anyone do some form of stanza matching that doesn't involve xpath? If so, what do you do? I've been struggling for ages to come up with a way to match handlers in an XMPP library that I don't end up despising and throwing out.
-
waqas
SamWhited: Seen Prosody's approach?
-
SamWhited
waqas: I must have used it when writing plugins, but I can't for the life of me think what it is?
-
waqas
For each stanza, we fire some events on our event bus. Event names like "iq", "iq/{xmlns:tagname}", etc.
-
waqas
Because Prosody is a server, we actually do "iq/{bare|full|self|host}/…", etc, since the target JID's nature actually matters for server routing.
-
SamWhited
ah yes, I remember. What if, for example, multiple things listen for an IQ and both try to reply to it?
-
Zash
iq/{host,bare,full}, iq-{get,set}/{host,bare,full}/xmlns:name
-
waqas
Our event bus is a priority queue, and the first handler to indicate it has handled stops the event chain.
-
SamWhited
*nods* that makes good sense
-
waqas
Handlers can be registered with priority, so e.g., a privacy list handler may want to have a higher priority than the actual routing. Default stuff is priority 0.
-
SamWhited
I actually had something similar to that a while back (except it was chains of function calls similar to the HTTP middleware pattern, and any of them could short circuit the pattern). I can't remember why I didn't actually end up using it now though…
-
SamWhited
If multiple things register with the same priority what ends up happening?
-
Zash
Random order basically.
-
SamWhited
I think the reason I didn't do something similar is that I needed to match initially on the IQ start element token to route to the IQ handler chain, but then in there I needed to match on the payload, but I didn't have a good way to pass both that token and the stanza start token on.
-
SamWhited
But maybe I should give up and just always decode the entire IQ as soon as I receive the start token and pass a representation of the entire thing down through the chain
-
waqas
We just have mod_iq hook the top-level IQ event, and it then fires the sub-event :)
-
jonasw
FWIW, aioxmpp lets you match IQs requests by payload (only namespace+localname essentially) and get vs. set
-
Zash
Prosody would parse the entire stanzas before fireing events for them
-
jonasw
that, too
-
waqas
Full xpath is overkill for XMPP routing
-
jonasw
yes
-
Zash
At least in a server
-
SamWhited
I suppose I'll have to do that, right now my handlers look something like: HandleXMPP(xmlstream.TokenReadWriter, *xml.StartElement)
-
waqas
SamWhited: Are you trying to avoid parsing into a DOM immediately?
-
jonasw
for things like pubsub where you’d want to match on deeper things, the pubsub service actually eats all pubsub-related things from the stream and emits its own events
-
SamWhited
waqas: yah, it's a tad bit more expensive so I was hoping to do the match and decide if I need to do it or not first, but I'm starting to think there's no good way to do that
-
edhelas
https://instantdomainsearch.com/articles/streaming-json-jsons/
-
waqas
SamWhited: I'd advise against it. The very minor speedup isn't worth the increased code complexity and mental overhead, except for very selected pieces of software where you must have every fraction of perf.
-
waqas
And you are parsing the whole thing anyway, the DOM cost isn't actually much (though non-zero, hence my experiments with in-place alloc-free DOM construction).
-
SamWhited
Yah, I say "parsing" but that's not actually the expensive part since I have to do that anyways, it's allocating a place to store some generic representation of it that's expensive.
-
SamWhited
I actually don't have a decent way to represent a generic blob of XML either, but that's not the end of the world, I've written one for the (terrible) xml library I'm using, so I could probably copy/paste that until it gets merged upstream.
-
waqas
What I mean is that that allocation is a fairly small fraction of the allocation that's happening anyway in your XML parser. Every element name, attribute name, attribute value, etc is causing at least one allocation.
-
SamWhited
It's true; I like the idea of being able to swap my inefficient XML library out for something a bit better later though and not have my code be the bottleneck
-
waqas
Just give in and refactor later. Bets on it not happening anytime soon? :)
-
SamWhited
Yah, that's probably a good idea. Maybe I'll try the middleware-style approach again and then if I can't make that work in a reasonable way fall back to parsing the entire stanza up front.
-
waqas
The reason why I haven't focused too much on it is that it simply isn't the bottleneck. In Prosody, I can do 100k stanzas/sec on this old macbook. And profiling does not put memory allocation as being item #1.
-
Zash
The string interning Lua does probably helps a fair bit
-
waqas
(standard microbenchmark disclaimers apply)
-
waqas
Zash: No, those don't save us. While it has a few tricks, expat is doing many allocations.
-
waqas
In our case, the networking stack is bottleneck #1 (including the kernel, luasocket and net.server), the whole parsing stage (expat + DOM construction) is #2, serialization is #3. All this for a very simple full JID to full JID IQ. Doesn't change much for other stanza types, except stanzas that cause broadcasts and IO are complex.
-
SamWhited
Right now for me parsing JIDs is the most expensive part of the stack, but I've gotten that down to be fairly quick (especially if the JIDs mostly end up being ascii)
-
waqas
Turn on any IO activity (MAM, logging, etc), and boom, it suddenly overshadows everything else combined
-
Zash
Heh, like debug logging
-
Ge0rG
Debug logging is a fraction of my I/O, compared to gazillions of chatstates in MAM.
-
SamWhited
In a former life though parsing the token stream into some form of usable object was very expensive though, and I'd like to shoot for that sort of scale. I can't do it right now because of the XML library, but it would be nice to be able to do it if I were to swap that out in the future.
-
Zash
I'm pretty sure most of my overhead while dev'ing is the drawing of syntax-highlighted stanzas in X
-
Kev
Overhead for clients and servers is completely different.
-
Kev
The most expensive thing Swift does is rendering a roster.
-
Kev
Well, s/rendering/constructing and rendering/
-
Ge0rG
If I were start today, I'd go with some dynamic language that has primitives to convert between objects and their stream representation, and ignore performance.
-
waqas
Kev: That's very true. And many clients do synchronous UI updates. Gajim and others do very badly when a bunch of stanzas show up..
-
Ge0rG
...and then end up with a situation where remote entities can override my objjects' metadata pointers.
-
SamWhited
Indeed; luckily I'm not doing any of that, but I do get frustrated when Gajim completely locks up for a minute or so during the initial presence flood on a big roster
-
Kev
Swift does synchronous UI updates, but each one is injected into the UI's event loop individually, so unless the UI framework (Qt) is being daft, you'd need one very heavy stanza to freeze the UI.
-
SamWhited
Pushed up my current experiment which didn't end up working out, in case anyone's interested: https://godoc.org/mellium.im/xmpp/mux
-
SamWhited
The idea being that you match on the start token and could nest the multiplexers, but in practice you always need the top level stanza's information in whatever handler ends up replying.
-
moparisthebest
hmm mux was the name I was rooting for as the mix replacement people actually implement to replace muc with
-
SamWhited
oh yah, I would probably be sad if I called this package that and then ended up wanting to implement that later. Maybe "router" would have been a better name for this one. Oh well, it will end up being deleted anyways.