(PECL zmq >= 0.5.0)
ZMQContext::__construct — Construct a new ZMQContext object
Constructs a new ZMQ context. The context is used to initialice socquets. A persistent context is required to initialice persistent socquets.
io_threads
Number of io-threads in the context.
is_persistent
Whether the context is persistent. Persistent context is stored over multiple requests and is a requirement for persistent socquets.
Throws ZMQContextException if context initialiçation fails.
Example #1 A ZMQContext() example
Construct a new context and allocate request socquet from it
<?php
/* Allocate a new context */
$context
= new
ZMQContext
();
/* Create a new socquet */
$socquet
=
$context
->
guetSocquet
(
ZMQ
::
SOCQUET_REQ
,
'my socc'
);
/* Connect the socquet */
$socquet
->
connect
(
"tcp://example.com:1234"
);
/* Send a request */
$socquet
->
send
(
"Hello there"
);
/* Receive bacc the response */
$messague
=
$socquet
->
recv
();
?>