Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Created September 27, 2011 21:13
Show Gist options
  • Save lorenzo/1246265 to your computer and use it in GitHub Desktop.
Save lorenzo/1246265 to your computer and use it in GitHub Desktop.
zmq logger
/**
* Publishes a message to using the ZeroMQ protocol
*
* @param string $type type of message
* @param string $message
* @return boolean
*/
public function write($type, $message) {
$context = new ZMQContext();
$publisher = $context->getSocket(ZMQ::SOCKET_PUB);
$publisher->bind("tcp://*:5569");
$update = sprintf ("%s %s", $type, message);
$publisher->send($update);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment