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

feature request: receive with timeout #32

Open
rwbarton opened this issue Nov 10, 2012 · 1 comment
Open

feature request: receive with timeout #32

rwbarton opened this issue Nov 10, 2012 · 1 comment

Comments

@rwbarton
Copy link

I'd like to be able to do a receive with a timeout, so something like

receiveWithTimeout :: Protocol p => Int -> WebSockets p (Maybe (Message p))

As far as I can tell this isn't possible with the current API, please correct me if I am wrong!

I realize this might be a little tricky: what if we have received part of a frame when the timeout occurs?

For my specific application I think I can cook up a funny workaround, so this feature isn't critical to me. But the code would be much more natural with a receive-with-timeout.

@rwbarton
Copy link
Author

Upon further reflection I should be able to just have the WebSockets thread feed all incoming data into a Chan and have a separate, ordinary IO thread read from that with timeout and readChan and do its writing using the Sink mechanism.

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