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

From: Misa Simic <misa(dot)simic(at)gmail(dot)com>
To: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is there any way to listen to NOTIFY in php without polling?
Date: 2013-03-29 20:21:54
Message-ID: CAH3i69nDbsjmAkngk9R=k2BTjpsth4PH=o-6fKQRR9gf3+ao4Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Janes...

I am not a C developer - was not aware about select()... I was read it as
some kind of sleep...

Than Clemens explained to me what select() does...

However - to me it is just implementation detail... Which is possible in
one language, but not in another...

But technically, is the loop inside select() - or outside is irrelevant to
me (i see the benefit... Though, not sure the benefit - is that
big...nowdays.....)

From my point of view - what is important - is the main goal what should be
achieved...

If with resources what I have (php - though I am not php developer either)
I dont have the same power like in another language - who cares - main goal
must be achived . things work - or dont, but we must make them work :)

I am just curious:

LISTEN foo
Select()

Another client says: NOTIFY bar

Will select() - get something from server?

Thanks,

Misa

On Thursday, March 28, 2013, Jasen Betts wrote:

> On 2013-03-27, Misa Simic <misa(dot)simic(at)gmail(dot)com <javascript:;>> wrote:
> > --20cf3074d6a0c370ce04d8ef50c1
> > Content-Type: text/plain; charset=UTF-8
> >
> > 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...
>
> that's polling.
>
> I just do a select() on the socket and the select either times out or
> lets me know something has come from the server. then I call whatever
> it is to check for notifies.
>
> > The same you can achieve with PHP...
>
> except PHP doesn't have select() and hides the socket.
>
> --
> ⚂⚃ 100% natural
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org<javascript:;>
> )
> 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 D'Arcy J.M. Cain 2013-03-29 20:30:04 Re: Money casting too liberal?
Previous Message Michael Nolan 2013-03-29 19:36:12 Re: Money casting too liberal?