[Haskell-cafe] haxr standalone server?
acowley at seas.upenn.edu
Thu Jan 5 21:25:23 CET 2012
On Thu, Jan 5, 2012 at 10:40 AM, Johannes Waldmann
<waldmann at imn.htwk-leipzig.de> wrote:
> How could I use haxr (http://www.haskell.org/haskellwiki/HaXR)
> to build a stateful server?
> It should listen on some port,
> and fork threads (inside Haskell land) to handle incoming calls.
> Any of the Haskell web frameworks can do this?
I use HaXR in conjunction with Snap. It basically boils down to using
Network.XmlRpc.Server (handleCall, methods) in conjunction with Snap's
getRequestBody and writeLBS.
The good news is you don't need to worry about forking your own
threads, the web server handles that. To make calls stateful, you just
stash away a reference in the handler you give Snap (or whatever web
server you use).
More information about the Haskell-Cafe