Closed ParkFramework closed 8 years ago
PostgreSQL notifications don't work that way.
HTH
Here's a working example, but I'm not sure how applicable it is to real world situations:
$c = new pq\Connection;
$x = false;
$c->listenAsync('name', function($name, $message) use(&$x) {
$x = true;
echo $message;
});
do {
while ($c->busy) {
$r = array($c->socket);
$w = $e = null;
if (stream_select($r, $w, $e, 10)) {
$c->poll();
}
}
} while (($c->getResult() && $c->execAsync("")) || !$x);
Ok.
Block time listen()
and notify()
is very small, so it's best to use them without async
.
Tthank.
Next for 10 seconds - psql:
PHP script callback notification not called, if use
$db->listen(...)
then everything works.