Re: Is there any way to listen to NOTIFY in php without polling? - Mailing list pgsql-general

From Clemens Eisserer
Subject Re: Is there any way to listen to NOTIFY in php without polling?
Date
Msg-id CAFvQSYRDTXn2WQ-UGcF-1c1hptR9-pSo1hq_-+bm8bJbN5THqQ@mail.gmail.com
Whole thread Raw
In response to Re: Is there any way to listen to NOTIFY in php without polling?  (Misa Simic <misa.simic@gmail.com>)
List 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


pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Money casting too liberal?
Next
From: Sergey Konoplev
Date:
Subject: Re: bloating index, pg_restore