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

Поиск
Список
Период
Сортировка
От Misa Simic
Тема Re: Is there any way to listen to NOTIFY in php without polling?
Дата
Msg-id CAH3i69=D1MGAKUZ9_GLajWSnEMwf6Pzoqti1kEDxzzQwtF+4Eg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Is there any way to listen to NOTIFY in php without polling?  (Clemens Eisserer <linuxhippy@gmail.com>)
Ответы Re: Is there any way to listen to NOTIFY in php without polling?
Список pgsql-general
Hi Clemens,

Well, I am not sure what you mean by polling...

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...

But I am not sure that is the main goal...

My guess is that main goal is let Web App know - something happened in database...

I am not aware about something else in JDBC then the same principle...

One object (listner) - in background thread - always asks for notify DB - if gets something - fires event... (then other Java objects - if subscribed on Listner - do whatever need to doon that event....)

If we want - to let WebPage aware about what happened - still we are in the problem... (if we will not use - some kind of polling from WebPage)

Potential Solution: websocket

The same solution would be possible and with php...

But better to dont make this mail more complex - if that is not the goal... :)

Kind Regards,

Misa









2013/3/27 Clemens Eisserer <linuxhippy@gmail.com>
Hi Misa

> What is the main goal?

The main goal is to perform some inter-system communication in the
case some rows in one table are updated (very seldom event).

> even using libpg - you need to call pg notify... Doc says, just using
> libpgtcl would be possible to get Notify event - without checking from time
> to time...

I found example 27-2 at
http://www.postgresql.org/docs/8.0/static/libpq-example.html , that
does exactly what I was looking for using low-level socket functions.
It seems to me this solution works without polling.

Regards, Clemens

PS: Compared to the libpq and php interfaces, the jdbc driver does a
really good job providing a useable interface for listen/notify to the
developers. Thanks :)


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Clemens Eisserer
Дата:
Сообщение: Re: Is there any way to listen to NOTIFY in php without polling?
Следующее
От: Steve Crawford
Дата:
Сообщение: Money casting too liberal?