JuliaWeb / HTTP.jl

HTTP for Julia
https://juliaweb.github.io/HTTP.jl/stable/
Other
626 stars 177 forks source link

[RFC] convenience function to check if websocket has incoming messages #1169

Open cpfiffer opened 2 months ago

cpfiffer commented 2 months ago

I need to be able to check if a websocket connection has an incoming message, and I want to open a PR to HTTP.jl to do so. I mostly just want to know the method name you'd suggest, though if there is a more idiomatic/correct way to check whether a message is available I am all ears.

I know that you can access the incoming bytes of a WebSocket with

has_message = !isempty(ws.readbuffer)

Some candidates for this function name:

Perhaps we don't need a convenience function here, but I'd at least like to add something to the documentation string.