jdev - 2020-07-13


  1. User1773717

    moparisthebest: I asked there about xmpp over websockets yesterday and got no response, do you have more info on that?

  2. moparisthebest

    doesn't support that right now, I suspect you'll be hard pressed to find a non-web client that does, may I ask why you want that?

  3. Link Mauve

    Gajim does though.

  4. User1773717

    > doesn't support that right now, I suspect you'll be hard pressed to find a non-web client that does, may I ask why you want that? I am confused, what do you exactly refer to with "why you want that?"?

  5. adrien

    User1773717: well, if the client can already easily establish a standard TLS connection above a TCP socket, there's no intetest to use websockets for me. Indeed with websockets, you can't manage stream data, you can only work by full message chunk.

  6. Link Mauve

    adrien, how is it an issue for XMPP?

  7. adrien

    There's no big problem I think, but it means you can't take advantage of buffering XMPP stream to an SAX xml parser directly. So, if you are able to manage the DNS, TLS and TCP stuff, I see no interest to propose to use WebSocket too.

  8. jonas’

    adrien, fwiw, you can also use SAX with WebSocket framing; just means you need to reset the parser state for each message to some extent.

  9. adrien

    Indeed, but if the message data is heavy, you can't buffer it to the parser, you have to store it entierly in some place.

  10. jonas’

    I suppose that depends on the websocket implementation

  11. adrien

    Nope, the XEP is clear about that: only full XMPP message must be sent

  12. jonas’

    soo?

  13. jonas’

    whether a websocket implementation allows you to stream the data into a streaming SAX parser is a websocket implementaiton detail, isn’t it?

  14. adrien

    Mmhh, I thought the Websocket `on_message` interface wasn't made to do streaming due to it's name.

  15. jonas’

    possibly

  16. jonas’

    also note that XMPP only guarantees stanza sizes up to 10 kB anyways; anything beyond that is implementation defined.

  17. adrien

    Nice, I didn't know about that limit. Now, I'm wondering how pubsub manage bigger data ☺

  18. adrien

    I have a lot to learn about xmpp :-)

  19. Kev

    XMPP says that a server's maximum stanza size must not be less than 10K.

  20. Kev

    You can phrase that as 'only guarantees stanza sizes up to 10K', but I think the give subtly different impressions.

  21. jonas’

    true

  22. flow

    adrien, I am not sure if xmpp impls ever should directly feed their network input to the parser

  23. jonas’

    flow, what’s the alternative?

  24. flow

    at least not without having some kind of stanza size enforcement in between

  25. jonas’

    I tend to disagree

  26. flow

    jonas’, maybe I did not a good job explaining what I mean. but if you just wrap the parser around the byte source, then you have no control over the stanza size and it often makes it harder to recover from an error

  27. flow

    here: byte source == the tcp socket

  28. jonas’

    with a SAX parser limits are pretty irrelevant, unless you store things somewhere. so you can simply "count" the size as you go while parsing, and when the data exceeds, you either kill the stream or forward (discarding data) until the end of the stanza

  29. jonas’

    (though the latter is very interesting with stream management)

  30. adrien

    Well, that's the SAX parser which should leverage error if it has consumed too many bytes.

  31. adrien

    jonas’: exactly :-)

  32. jonas’

    however, if you try to guess the stanza size before parsing with a proper XML parser, you end up re-doing much of the XML parsing.

  33. jonas’

    which sounds painful

  34. flow

    jonas’, I do mostly stax (pull) parsing, not sax (push) parsing, and there, counting the offset in the currently parsed stanza is some effort. is it easier with a typical sax API?

  35. Kev

    Even with pull it's relatively straightforward to say "There's been too much data read since the last stanza event" isn't it?

  36. jonas’

    I don’t care about bytes in the end

  37. Kev

    Which isn't the same as a cut-off at a precise point, but does the job.

  38. jonas’

    yeah, nodes is more interesting, though counting character data is also relevant

  39. jonas’

    but both is not much of a big deal

  40. flow

    Kev, sure you can always manually "count" the input. I ideally you want to able to tell the parser to set a mark and then be able to query the current offset from that mark

  41. flow

    Kev, sure you can always manually "count" the input. But I think ideally you want to able to tell the parser to set a mark and then be able to query the current offset from that mark

  42. flow

    adrien, re how pubsub manages bigger data: pick at least one of: (1) not (2) don't care or (3) split into smaller (4KiB) chunks

  43. moparisthebest

    jonas’, sed to C translator written in sed : https://github.com/lhoursquentin/sed-bin