PHP ZMQ Extension Version 1.0.0
Note: This article was originally published at Planet PHP on 28 September 2011.ZeroMQ bindings (1.0.0) is available from the pear.zero.mq PEAR channel. This version has several new features, such as support for building against version 2.1+ or 3.x of ZeroMQ, including exposing the various new features of 3. It also allow retrieval of the ZMQ_FD file descriptor for use in external polls, supports PHP 5.4, and fixes various small bugs and issues. However, there are some changes that will break backwards compatibility and so userland code may need to be updated before moving to the new version. The most likely candidates for causing trouble are:1) Poll timeouts are now specified in milliseconds rather than microseconds. The upshot is that you need to divide any existing timeouts by 1000, else your five second timeout will in fact last for the best part of an hour!2) SWAP has been removed - if you were using SWAP before, you'll need to either increase HWMs appropriately, or move to a different solution to allow disk based queuing (such as the new, but potentially useful PZQ: https://github.com/mkoppanen/pzq).3) Devices have been refactored - instead of the constructor running the device, you now have a separate run() method which should be called on the ZMQDevice object. setIdleTimeout and setIdleCallback methods have been added to the object to allow more control over the device behaviour.Also, any new code should use ZMQ::MODE_DONTWAIT rather than ZMQ::MODE_NOBLOCK in the flags to send and recv calls - both versions are valid, but the latter is deprecated.Mikko Koppanen*, as usual, did the lions share of the work, but thanks also to Ben Gray for contributing some useful parts of the 3.0 feature support.* Who is available for custom PHP extension development, of course.