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

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: Clemens Eisserer <linuxhippy(at)gmail(dot)com>
Cc: pgsql <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:11:10
Message-ID: CAH3i69=D1MGAKUZ9_GLajWSnEMwf6Pzoqti1kEDxzzQwtF+4Eg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2013-03-27 22:12:40 Money casting too liberal?
Previous Message Clemens Eisserer 2013-03-27 21:46:14 Re: Is there any way to listen to NOTIFY in php without polling?