Re: Is there any way to listen to NOTIFY in php without polling?

From: Clemens Eisserer <linuxhippy(at)gmail(dot)com>
To: Misa Simic <misa(dot)simic(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Is there any way to listen to NOTIFY in php without polling?
Date: 2013-03-27 22:16:58
Message-ID: CAFvQSYRDTXn2WQ-UGcF-1c1hptR9-pSo1hq_-+bm8bJbN5THqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Misa

> But Example shows - that C app - actually asks all the time to get notify...
> when gets something more then 4 times - exit... until 4 times loops...
> The same you can achieve with PHP...

As far as I understood, with php I have to query the server again and
again, and pg_get_notify will either return something or not depending
on the query result:
http://php.net/manual/en/function.pg-get-notify.php

The provided sample however blocks until a notify is received (and
does so 4 times just for demonstration puporse), so instead of
frequently asking the server for notifications (polling), it wakes up
when a notification arrives.

> My guess is that main goal is let Web App know - something happened in
> database...
It isn't ;)

Regards, Clemens

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2013-03-27 23:48:14 Re: Money casting too liberal?
Previous Message Steve Crawford 2013-03-27 22:12:40 Money casting too liberal?