[Haskell-cafe] Happstack events and web page refreshing

Corentin Dupont corentin.dupont at gmail.com
Mon Jan 17 18:25:00 CET 2011

Thanks a lot for your response Jeremy.
I can see a lot of site that does update infos without the user to have to
click "refresh" (I think Facebook does?).
Do they do polling?
I think this approach would be fine for me, my app if not very fast paced.
Then I don't need to add a event handler to happstack-state ;)

This is done with something like: <META HTTP-EQUIV="*Refresh*" CONTENT="*n*
"> ?


On Mon, Jan 17, 2011 at 5:41 PM, Jeremy Shaw <jeremy at n-heptane.com> wrote:

> Hello,
> The problem is that clients are not 'connected' to the web server. The way
> it works (more or less) is:
>  1. client connects to server and sends a Request
>  2. server sends a Response
>  3. connection is terminated.
> So, once the page has been loaded there is no connection between the
> web-server and the client. Hence there is no way for the server to send
> anything to the clients.
> In HTML 5, there is something known as web sockets with does allow you to
> have a persistent connection to the clients. However, it does not yet have
> broad browser support. In fact, some browsers have temporarily removed
> support due to a security flaw in the design specification.
> There are a variety of hacks collectively known as 'comet' for trying to
> create a persistent connection on top of the existing HTTP 1.1 standard:
> http://en.wikipedia.org/wiki/Comet_(programming)<http://en.wikipedia.org/wiki/Comet_%28programming%29>
> That deals with trying to have the server push updates to the client.
> A different approach is to have the clients pull new data from the server
> by polling the server for changes every now and then. But that depends on
> how much latency you can afford for the updates. For example,  if updating
> only once a minute is fine versus must update every second.
> Once you decide how to get the data to the client, then you can figure out
> how to track changes to the MACID database.
> - jeremy
> On Jan 17, 2011, at 4:58 AM, Corentin Dupont wrote:
> Hello again,
> I have another question for happstack users/experts:
> I have a program with happstack-state and a web server with
> happstack-server.
> What I'd like is, whenever the MACID state is changed, that the web page is
> refreshed for every clients
> connected on the web server.
> So I think the question is 2 fold:
> - How to add an event handler on happstack-state for that?
> - How to ask to the web server to refresh every clients?
> I did not found infos about that in the API.
> Thanks a lot,
> Corentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110117/e19d012f/attachment.htm>

More information about the Haskell-Cafe mailing list