[web-devel] A WebSocket library

Chris Smith cdsmith at gmail.com
Sun Sep 25 22:43:47 CEST 2011

Ah, nice!  Thank you.

So I'm trying to work out what the minimum "normal" API would be for
using this (via Snap or WAI, for example).  What I'm coming up with is
that first of all, the following would be used in the integration layer:

    data Request
    data Response

The interface to the application programmer is less clear.  Is the
expectation that you'd use the WebSocketData type class?  But then the
abstraction looks a bit weak since you have to think in terms of text or
data frames anyway... so ignoring that, the following looks closest to
what I'd want:

    data WebSockets a
    data DataMessage

and a new export:

    getDataMessageSender :: WebSockets (DataMessage -> IO ())
    getDataMessageSender = fmap ($ dataMessage) getSender

to use with a forkIO.  Is this something like what you'd expect people
to do?


More information about the web-devel mailing list