Need HTTP.WebSockets documentation

Hello, I’m trying to do something useful with websockets. I’m unable to find its documentation.

julia> import HTTP.WebSockets

help?> HTTP.WebSockets
  No documentation found.

  No docstring found for module HTTP.WebSockets.

Not even a docstring. :frowning_face:

There two examples here GitHub - JuliaWeb/HTTP.jl: HTTP for Julia - but they don’t really explain anything. For example, websockets use so called messages, as defined in RFC6455. But the example does not use that concept. It just reads from the socket (as a stream with readavailable) and writes it as a stream. After examinig its source code, it turned out that readavailable reads whole frames.

Can I assume, that readavailable will always return whole messages, and never fragments?

Also, it seems that there is no upper limit on the message size, and WebSockets.jl simply extends a read buffer (ws.rxpayload) when the message is longer. Since the payload is stored in memory, it would be easy to fill up the server’s memory with a huge message. Is this a known problem? Or maybe I’m not noticing something.

8 Likes