/** @inheritdoc */ public function onOpen(ConnectionInterface $conn) { Logger::debug($this, "RatchetTransportProvider::onOpen"); $transport = new RatchetTransport($conn, $this->loop); // this will need to be a little more dynamic at some point $transport->setSerializer(new JsonSerializer()); $transport->setTrusted($this->trusted); $session = $this->router->createNewSession($transport); $this->sessions->attach($conn, $session); $this->router->getEventDispatcher()->dispatch("connection_open", new ConnectionOpenEvent($session)); }
/** * When a new connection is opened it will be passed to this method * @param ConnectionInterface $conn The socket/connection that just connected to your application * @throws \Exception */ function onOpen(ConnectionInterface $conn) { $this->manager->debug("RatchetTransportProvider::onOpen"); $transport = new RatchetTransport($conn, $this->loop); // this will need to be a little more dynamic at some point $transport->setSerializer(new JsonSerializer()); $this->transports->attach($conn, $transport); $this->peer->onOpen($transport); // $session = new Session($conn); // // $this->sessions->attach($conn, $session); }