HTTP.jl
HTTP.jl copied to clipboard
[RFC] convenience function to check if websocket has incoming messages
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:
-
isempty(ws::WebSocket)
-
eof(ws::WebSocket)
would be semi-idiomatic here, but theIOBuffer
has already been read intoreadbuffer
(I think?)
Perhaps we don't need a convenience function here, but I'd at least like to add something to the documentation string.