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

From Misa Simic
Subject Re: Is there any way to listen to NOTIFY in php without polling?
Date
Msg-id CAH3i69=D1MGAKUZ9_GLajWSnEMwf6Pzoqti1kEDxzzQwtF+4Eg@mail.gmail.com
Whole thread Raw
In response to Re: Is there any way to listen to NOTIFY in php without polling?  (Clemens Eisserer <linuxhippy@gmail.com>)
Responses Re: Is there any way to listen to NOTIFY in php without polling?
List 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 by date:

Previous
From: Clemens Eisserer
Date:
Subject: Re: Is there any way to listen to NOTIFY in php without polling?
Next
From: Steve Crawford
Date:
Subject: Money casting too liberal?