void
pq\Connection::listen(string
$channel, callable
$listener)Listen on $channel for notifications. See pq\Connection::unlisten().
string
$channel#callable
$listener# as function(string
$channel, string
$message#, int
$pid#)callback
automatically called whenever a notification on $channel arrives.
<?php
$conn = new pq\Connection;
$conn->listen("queue", function($channel, $message, $backend_pid) {
printf("Connection on backend %d said %s\n", $backend_pid, $message);
});
?>