Ошибка Laravel с сообщением 'Корень фасада не установлен

Я недавно установил Ratchet на мой laravel установка для включения push-сервисов через сокеты.

Вот как выглядит мой класс SocketController (примечание: он НЕ расширяет контроллер)

class SocketController implements WampServerInterface
{
    /**
     * A lookup of all the topics clients have subscribed to
     */
    protected $subscribedTopics = array();

    public function onSubscribe(ConnectionInterface $conn, $topic) {
        echo"\n SUBSCRING TOPIC: $topic";
        echo "   hi  \n";

        try {
            JWTAuth::parseToken("okay");


        } catch (TokenExpiredException $e) {
            echo "hi" ;

        } catch (TokenInvalidException $e) {

            echo "hi" ;

        } catch (JWTException $e) {

            echo "hi" ;

        }
        catch(\Exception $q){
            echo $q;

        }

        $this->subscribedTopics[$topic->getId()] = $topic;
    }

    /**
     * @param string JSON'ified string we'll receive from ZeroMQ
     */
    public function onBlogEntry($entry) {
        $entryData = json_decode($entry, true);

        // If the lookup topic object isn't set there is no one to publish to
        if (!array_key_exists($entryData['category'], $this->subscribedTopics)) {
            return;
        }

        $topic = $this->subscribedTopics[$entryData['category']];

        // re-send the data to all the clients subscribed to that category
        $topic->broadcast(rand(5,666666));
    }

    public function onUnSubscribe(ConnectionInterface $conn, $topic) {
    }
    public function onOpen(ConnectionInterface $conn) {
        echo"open";

    }
    public function onClose(ConnectionInterface $conn) {
        echo "close";
    }

    /* The rest of our methods were as they were, omitted from docs to save space */
    /**
     * If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown,
     * the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method
     * @param  ConnectionInterface $conn
     * @param  \Exception $e
     * @throws \Exception
     */
    function onError(ConnectionInterface $conn, \Exception $e)
    {
        // TODO: Implement onError() method.
    }

    /**
     * An RPC call has been received
     * @param \Ratchet\ConnectionInterface $conn
     * @param string $id The unique ID of the RPC, required to respond to
     * @param string|Topic $topic The topic to execute the call against
     * @param array $params Call parameters received from the client
     */
    function onCall(ConnectionInterface $conn, $id, $topic, array $params)
    {
        // TODO: Implement onCall() method.
    }

    /**
     * A client is attempting to publish content to a subscribed connections on a URI
     * @param \Ratchet\ConnectionInterface $conn
     * @param string|Topic $topic The topic the user has attempted to publish to
     * @param string $event Payload of the publish
     * @param array $exclude A list of session IDs the message should be excluded from (blacklist)
     * @param array $eligible A list of session Ids the message should be send to (whitelist)
     */
    function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible)
    {
        // TODO: Implement onPublish() method.
    }

Я использую библиотеку JWT, и просто чтобы проверить, есть ли строка

    JWTAuth::parseToken("okay");

Но эта строка выдает ошибку:

исключение 'RuntimeException' с сообщением 'Корень фасада не был установлен.'

Как включить аутентификацию JWT в мой собственный класс?

0 ответов

Другие вопросы по тегам