/**
* Handle ZMQ Write Event.
*/
public function handleWriteEvent()
{
foreach ($this->messages as $i => $message) {
try {
$message = (array) $message;
$sent = (bool) $this->socket->sendmulti($message, ZMQ::MODE_DONTWAIT);
unset($this->messages[$i]);
if (0 === count($this->messages)) {
$this->loop->removeWriteStream($this->fd);
$this->listening = false;
$this->emit('end');
}
} catch (ZMQSocketException $ex) {
$this->emit('error', [$ex]);
}
}
}