/** * Write frame to server * * @param Frame $stompFrame */ protected function _writeFrame(Frame $stompFrame) { if (!is_resource($this->_socket)) { throw new StompException('Socket connection hasn\'t been established'); } $data = $stompFrame->__toString(); $r = fwrite($this->_socket, $data, strlen($data)); if ($r === false || $r == 0) { $this->_reconnect(); $this->_writeFrame($stompFrame); } }
/** * Write frame to server. Reimplemented to add debug support * * @param Frame $stompFrame * @throws StompException */ protected function _writeFrame(Frame $stompFrame) { if (!is_resource($this->_socket)) { throw new StompException('Socket connection hasn\'t been established'); } $data = $stompFrame->__toString(); $r = fwrite($this->_socket, $data, strlen($data)); if ($r === false || $r == 0) { $this->_reconnect(); $this->_writeFrame($stompFrame); } else { if ($this->debug) { echo "STOMP FRAME SENT:\n " . str_replace("\n", "\n ", $data) . "\n"; } } }