_init($command, $headers, $body); } protected function _init ($command = null, $headers = null, $body = null) { $this->command = $command; if ($headers != null) { $this->headers = $headers; } $this->body = $body; if ($this->command == 'ERROR') { require_once 'Exception.php'; throw new StompException($this->headers['message'], 0, $this->body); } } /** * Convert frame to transportable string * * @return string */ public function __toString() { $data = $this->command . "\n"; foreach ($this->headers as $name => $value) { $data .= $name . ": " . $value . "\n"; } $data .= "\n"; $data .= $this->body; return $data .= "\x00"; } } ?>