4 <?php include "_skipif.inc"; ?>
11 $consumer = new pq\Connection(PQ_DSN);
12 $consumer->listen("test", function($channel, $message, $pid) {
13 printf("%s(%d): %s\n", $channel, $pid, $message);
16 $producer = new pq\Connection(PQ_DSN);
17 $producer->notify("test", "this is a test");
19 $consumer->exec("select 1");
21 $producer->notify("test", "this is an async test");
23 $r = array($consumer->socket);
25 stream_select($r, $w, $e, NULL);
28 $producer->notify("other", "this should not show up");
30 stream_select($r, $w, $e, 0,1000);
33 $producer->notify("test", "just to be sure");
35 $r = array($consumer->socket);
37 stream_select($r, $w, $e, 0,1000);
40 $consumer->unlisten("test");
42 $producer->notify("test", "this shouldn't show up either");
44 $r = array($consumer->socket);
46 stream_select($r, $w, $e, 0,1000);
53 test(%d): this is a test
54 test(%d): this is an async test
55 test(%d): just to be sure