public function on_write_ready($fd)
{
//JAXLLogger::debug("on write ready called");
$total = strlen($this->obuffer);
$bytes = @fwrite($fd, $this->obuffer);
$this->send_bytes += $bytes;
JAXLLogger::debug("sent " . $bytes . "/" . $this->send_bytes . " of data");
JAXLLogger::debug(substr($this->obuffer, 0, $bytes));
$this->obuffer = substr($this->obuffer, $bytes, $total - $bytes);
// unwatch for write if obuffer is empty
if (strlen($this->obuffer) === 0) {
JAXLLoop::unwatch($fd, array('write' => true));
$this->writing = false;
}
//JAXLLogger::debug("current obuffer size: ".strlen($this->obuffer)."");
}