protected function parseNormal($message)
{
// Can be a command or a result
if ($message && property_exists($message, 'id')) {
if (property_exists($message, 'result')) {
if ($this->isWaitingMessage) {
if ($message->id == $this->waitingMessageId) {
$this->waitingMessageResult = $message->result;
$this->isWaitingMessage = false;
} else {
$this->parseMessagesBuffer[] = $message;
}
} else {
$this->callMessageCallback($message->id, $message->result);
}
} else {
// @todo: Command implementation
}
return;
}
// It's waiting a message? Store for future parsing
if ($this->isWaitingMessage) {
$this->parseMessagesBuffer[] = $message;
return;
}
// This is a notification/event!
if ($message && !property_exists($message, 'id')) {
if ($message->method == 'callObjectEventListener') {
// @todo: Check if params contains all the items
$this->callObjectEventListener($message->params[0], $message->params[1]);
}
}
}