Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cpfiffer opened this issue Apr 14, 2024 · 0 comments
Open

Comments

@cpfiffer
Copy link

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 the IOBuffer has already been read into readbuffer (I think?)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant