Thruway\Peer\Router::managerGetSessions PHP Method

managerGetSessions() public method

Get list sessions
public managerGetSessions ( ) : array
return array
    public function managerGetSessions()
    {
        $theSessions = [];
        foreach ($this->sessions as $key) {
            /* @var $session \Thruway\Session */
            $session = $this->sessions[$key];
            $sessionRealm = null;
            // just in case the session is not in a realm yet
            if ($session->getRealm() !== null) {
                $sessionRealm = $session->getRealm()->getRealmName();
            }
            if ($session->getAuthenticationDetails() !== null) {
                $authDetails = $session->getAuthenticationDetails();
                $auth = ["authid" => $authDetails->getAuthId(), "authmethod" => $authDetails->getAuthMethod()];
            } else {
                $auth = new \stdClass();
            }
            $theSessions[] = ["id" => $session->getSessionId(), "transport" => $session->getTransport()->getTransportDetails(), "messagesSent" => $session->getMessagesSent(), "sessionStart" => $session->getSessionStart(), "realm" => $sessionRealm, "auth" => $auth];
        }
        return [$theSessions];
    }