Get transport
public getTransport ( ) : Thruway\Transport\TransportInterface | ||
return | Thruway\Transport\TransportInterface |
/** * @param AbstractSession $session * @param Message $msg * @return mixed|void */ public function onMessage(AbstractSession $session, Message $msg) { $this->manager->debug("Broker onMessage for " . json_encode($session->getTransport()->getTransportDetails()) . ": " . json_encode($msg)); if ($msg instanceof PublishMessage) { $this->processPublish($session, $msg); } elseif ($msg instanceof SubscribeMessage) { $this->processSubscribe($session, $msg); } elseif ($msg instanceof UnsubscribedMessage) { $this->processUnsubscribe($session, $msg); } else { $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg)); } }
/** * Handle received message * * @param \Thruway\AbstractSession $session * @param \Thruway\Message\Message $msg * @throws \Exception * @return mixed|void */ public function onMessage(AbstractSession $session, Message $msg) { Logger::debug($this, "Broker onMessage for " . json_encode($session->getTransport()->getTransportDetails()) . ": " . json_encode($msg)); if ($msg instanceof PublishMessage) { $this->processPublish($session, $msg); } elseif ($msg instanceof SubscribeMessage) { $this->processSubscribe($session, $msg); } elseif ($msg instanceof UnsubscribeMessage) { $this->processUnsubscribe($session, $msg); } else { throw new \Exception("Unhandled message type sent to broker: " . get_class($msg)); } }