(PECL zmq >= 0.5.0)
Construct a new ZMQContext object
ZMQContext::__construct ([ integer $io_threads = 1 [, boolean $is_persistent = true ]] )
Constructs a new ZMQ context. The context is used to initialize sockets. A persistent context is required to initialize persistent sockets.
Parameters:
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 sockets.
Returns:
Throws ZMQContextException if context initialization fails.
Examples:
A ZMQContext() example
Construct a new context and allocate request socket from it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php /* Allocate a new context */ $context = new ZMQContext(); /* Create a new socket */ $socket = $context ->getSocket(ZMQ::SOCKET_REQ, 'my sock' ); /* Connect the socket */ /* Send a request */ $socket ->send( "Hello there" ); /* Receive back the response */ $message = $socket ->recv(); ?> |
Please login to continue.