예제 #1
0
 /**
  * Write frame to server.
  *
  * @param Frame $stompFrame
  * @return boolean
  * @throws ConnectionException
  */
 public function writeFrame(Frame $stompFrame)
 {
     if (!$this->isConnected()) {
         throw new ConnectionException('Not connected to any server.', $this->activeHost);
     }
     $data = $stompFrame->__toString();
     if (!@fwrite($this->connection, $data, strlen($data))) {
         throw new ConnectionException('Was not possible to write frame!', $this->activeHost);
     }
     return true;
 }
예제 #2
0
 /** @test */
 public function shouldConvertFrameWithoutBodyToString()
 {
     $frame = new Frame('SEND', array('destination' => '/queue/a'));
     $result = $frame->__toString();
     $this->assertEquals("SEND\ndestination:/queue/a\n\n", $result);
 }