output = $output; } /** * Sends a Message to the client * * @param Message $msg * @return void */ public function write(Message $msg) { $data = (string)$msg; $msgSize = strlen($data); $totalBytesWritten = 0; while ($totalBytesWritten < $msgSize) { $bytesWritten = fwrite($this->output, substr($data, $totalBytesWritten)); $totalBytesWritten += $bytesWritten; } } }