Open jhickner opened 11 years ago
This is indeed pretty hard at the moment. I hope to rewrite the WebSockets library using io-streams soon, once that's done this should become a lot more straightforward.
@jhickner I guess what you are trying to do now should be possible with the 0.8 API
Hello,
I have an existing application that uses the Pipes library, and I'm wondering if it's possible to create a
Producer
(source) from a websocket connection.Usually creating producers is pretty simple. Here's an example that reads from a
Chan
:It's just a matter of looping forever trying to read from a resource, and then
respond
ing anything you get. But only being able to read from a websocket inside the WebSockets monad makes it tricky, since you can't userespond
there.One workaround I've found is to write to a
Chan
from inside the WebSockets monad, but then each client thread requires a second reader thread. I'm hoping there's a better way, but I haven't been able to find one. Any help would be appreciated.Thanks