[web-devel] Happstack events and timeouts
Jeremy Shaw
jeremy at n-heptane.com
Wed Jan 16 21:46:26 CET 2013
Requests will be automatically killed if no data is sent or received
for the duration of the timeout period -- which defaults to 30
seconds. You can change that by setting the timeout field in your
'Conf':
http://happstack.com/docs/happstack-server-7.0.2/doc/html/happstack-server/Happstack-Server-Internal-Types.html#t:Conf
If you want to only allow a user to only have one concurrent
connection.. then you would need to use a cookie to identify each
user. Then you could use something like a Set inside and STM var to
track what users are currently connected. Though you have to be
careful to ensure that users are correctly removed from the Set even
when the connection is terminated via an exception, etc. You would
initialize the STM var in your main before you call simpleHTTP:
do stmv <- atomatically $ newTVar Set.empty
simpleHTTP nullConf (handler stmv)
That way all connections can share access to the tvar.
The one-connection per user thing sounds a bit odd to me.. but maybe it is ok.
- jeremy
On Sun, Jan 13, 2013 at 1:56 PM, Asafe Ribeiro <asafe.hai.kai at gmail.com> wrote:
> I've a timeline that is automatically updated when a user I follow post
> something new.
>
> I've already done the client-side code and some of the server-side as well.
> But I have a couple of issues that I cant figure out how to with happstack:
>
> How do I set a timeout for the request?
>
> I don't want to have more than one request for a same user. How can I stop
> all other request when I get a new one for a given user ?
>
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>
More information about the web-devel
mailing list