long polling

Justin Sheehy justin at iago.org
Thu Jul 2 15:46:19 EDT 2009


On Thu, Jul 2, 2009 at 6:57 AM, pablo platt<pablo.platt at gmail.com> wrote:

> Thank you for this example, it's an excellent resource for me.

You're quite welcome.

> In your code you assume ...

Yes.  That code was just meant to be a demonstration that long-polling
works in a context like what you asked about; it is certainly not a
real pub/sub implementation worth using in any way other than as an
example.  You most likely want to start from scratch in your
implementation and not by copying that example.

> To make the request timeout and respond automatically after 1 minute if
> there are no incoming messages,
> do I need to change the wait(Client) function?

You could do that, or you could switch it out for a gen_server call or similar.

> In the wait function, is self() the actual GET/POST request process?

It is the Webmachine decision process, executing wait/0 inside of
get_data/2 which is responsible for producing the body for a GET
request.

-Justin



More information about the webmachine mailing list