Hi yi,

WAI is and will always be designed for HTTP. Websockets is a different protocol (even though it is normally initiated over HTTP). If there is a way that makes sense to put it websockets into WAI, it can definitely be considered. But I believe the current plan is to put Websocket support into Warp. Haskell code re-use will be achieved through this Websockets library. Does that seem reasonable to you?

Greg Weber

On Sun, Sep 25, 2011 at 6:11 PM, yi huang <yi.codeplayer@gmail.com> wrote:
On Mon, Sep 26, 2011 at 12:15 AM, Jasper Van der Jeugt <m@jaspervdj.be> wrote:
Hi Michael,

> I think my main question is: why take an enumerator? Should the
> function just run as an iteratee? I know that will make it much more
> amenable to integration with Warp. All of Warp's internal processing
> lives inside an Iteratee, so we can't really extract an Enumerator
> from there. This is already how Warp handles the request body (the
> application lives in an Iteratee), so I think the approach is sound.

You're right. I had this enumerator argument because initially it tied
in better with my "demo" socket server. I've removed it, the type
signature is now:

   runWebSockets :: WebSockets a
                 -> Iteratee ByteString IO ()
                 -> Iteratee ByteString IO a

This should work out better for Warp integration, if I understood you correctly.

This still don't work with wai at the present, because there's no way to create the outer iteratee which is used to send data back to client directly.
I propose to expose such an iteratee through wai Request type.
 

Cheers,
Jasper

_______________________________________________
web-devel mailing list
web-devel@haskell.org
http://www.haskell.org/mailman/listinfo/web-devel



--
http://www.yi-programmer.com/blog/

_______________________________________________
web-devel mailing list
web-devel@haskell.org
http://www.haskell.org/mailman/listinfo/web-devel