[web-devel] Happstack events and timeouts

Asafe Ribeiro asafe.hai.kai at gmail.com
Thu Jan 17 14:59:16 CET 2013


Guess I didn't word it properly.

If I change the timeout on the Conf it 'll affect all requests.

If one update handler is already running for a given user, no need to run
another because the client will issue another request as soon as it gets a
response from the server. I wanted to avoid the server be flooded with
update requests.




On Wed, Jan 16, 2013 at 6:46 PM, Jeremy Shaw <jeremy at n-heptane.com> wrote:

> 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20130117/bcc7fd28/attachment.htm>


More information about the web-devel mailing list