
On Fri, Mar 2, 2012 at 5:19 PM, Paul Graphov
Hello Cafe!
I am trying to implement networked application in Haskell. It should accept many client connections and support bidirectional conversation, that is not just loop with Request -> Response function but also sending notifications to clients etc.
Hi,
The tutorial I gave for CUFP 2011 was a multi-user web chat program using
the Snap Framework. STM channels make this kind of problem super-easy to
deal with. Don't be afraid of forking lots of Haskell threads for programs
like this, because they're "green" threads, not OS threads (i.e. Haskell
threads are M:N multiplexed onto OS threads) and as such they have very
little overhead.
Maybe you'll find the code interesting:
https://github.com/snapframework/cufp2011. The "business logic" of using
STM channels is here:
https://github.com/snapframework/cufp2011/blob/master/src/Snap/Chat/ChatRoom...
G
--
Gregory Collins