docs.unity3d.com
    Show / Hide Table of Contents

    Class SessionsManager

    Provides methods to handle session management.

    Inheritance
    Object
    SessionsManager
    Namespace: Unity.PSN.PS5.Sessions
    Syntax
    public class SessionsManager

    Fields

    OnRawUserEvent

    Set an external event callback to provide additional process after player session has processed any WebApi events

    Declaration
    public static SessionsManager.RawUserSessionEventHandler OnRawUserEvent
    Field Value
    Type Description
    SessionsManager.RawUserSessionEventHandler

    Properties

    ActiveGameSessions

    A list of active game sessions. This is a snap shot of the current active sessions. If any sessions are deleted or created this property needs to be used again to get an accurate state of the system.

    Declaration
    public static List<GameSession> ActiveGameSessions { get; }
    Property Value
    Type Description
    List<GameSession>

    ActivePlayerSessions

    A list of active player sessions. This is a snap shot of the current active sessions. If any sessions are deleted or created this property needs to be used again to get an accurate state of the system.

    Declaration
    public static List<PlayerSession> ActivePlayerSessions { get; }
    Property Value
    Type Description
    List<PlayerSession>

    OnUserEvent

    The session notification callback. Note that this type of update doesn't contain any data to the locally cached data doesn't reflect the change. This only notifies what type of data changed. Use PlayerSessionRequests.GetPlayerSessionsRequest to retieve the latest data about the session.

    Declaration
    public static SessionsManager.UserEventHandler OnUserEvent { get; set; }
    Property Value
    Type Description
    SessionsManager.UserEventHandler

    PlayerSessionFilters

    The player session filters used when creating a player session. Defaults to PlayerSessionFilters

    Declaration
    public static WebApiFilters PlayerSessionFilters { get; set; }
    Property Value
    Type Description
    WebApiFilters

    UserSessionFilters

    The user session filters set for each local user when a user push event is created. Defualts to UserSessionFilters

    Declaration
    public static WebApiFilters UserSessionFilters { get; set; }
    Property Value
    Type Description
    WebApiFilters
    Remarks

    Default filters are: "psn:sessionManager:ps:invitations:created", "psn:sessionManager:gs:invitations:created", "psn:sessionManager:gs:sessionMessage:created"

    Methods

    FindGameSessionFromSessionId(String)

    Find a session instance from a session id

    Declaration
    public static GameSession FindGameSessionFromSessionId(string sessionId)
    Parameters
    Type Name Description
    String sessionId

    The session id to find

    Returns
    Type Description
    GameSession

    FindGameSessionFromUserId(Int32)

    Find session from a local user id. The user can be a player or spectator

    Declaration
    public static GameSession FindGameSessionFromUserId(int userId)
    Parameters
    Type Name Description
    Int32 userId
    Returns
    Type Description
    GameSession

    FindPlayerSessionFromSessionId(String)

    Find a session instance from a session id

    Declaration
    public static PlayerSession FindPlayerSessionFromSessionId(string sessionId)
    Parameters
    Type Name Description
    String sessionId

    The session id to find

    Returns
    Type Description
    PlayerSession

    FindPlayerSessionFromUserId(Int32)

    Find session from a local user id. The user can be a player or spectator

    Declaration
    public static PlayerSession FindPlayerSessionFromUserId(int userId)
    Parameters
    Type Name Description
    Int32 userId
    Returns
    Type Description
    PlayerSession

    FindSessionFromSessionId(String)

    Find a session instance from a session id

    Declaration
    public static Session FindSessionFromSessionId(string sessionId)
    Parameters
    Type Name Description
    String sessionId

    The session id to find

    Returns
    Type Description
    Session

    GetUserSessionPushEvent(Int32)

    Get the WebApiPushEvent for a user if one has been created

    Declaration
    public static WebApiPushEvent GetUserSessionPushEvent(int userId)
    Parameters
    Type Name Description
    Int32 userId

    The local userId

    Returns
    Type Description
    WebApiPushEvent

    The push event object

    IsUserRegistered(Int32)

    Has a push event been registered for the given local user

    Declaration
    public static bool IsUserRegistered(int userId)
    Parameters
    Type Name Description
    Int32 userId

    The local userId

    Returns
    Type Description
    Boolean

    Returns true if the push event is registered

    RegisterUserSessionEvent(Int32)

    Register a userId with the session system so it creates a WebApiPushEvent using the UserSessionFilters filters.

    Declaration
    public static void RegisterUserSessionEvent(int userId)
    Parameters
    Type Name Description
    Int32 userId

    The local user id to register

    Remarks

    This creates a WebApiNotifications.RegisterPushEventRequest request which is added to the WebApiNotifications queue. The user won't be fully registered until the request has been processed. Use IsUserRegistered(Int32) to check if the user registration is complete

    Schedule(AsyncOp)

    Schedule an AsyncOp by adding it to the internal Session queue

    Declaration
    public static void Schedule(AsyncOp op)
    Parameters
    Type Name Description
    AsyncOp op

    The operation to schedule

    UnregisterUserSessionEvent(Int32)

    Unregister the user WebApiPushEvent from the system.

    Declaration
    public static void UnregisterUserSessionEvent(int userId)
    Parameters
    Type Name Description
    Int32 userId

    The local user id

    UpdateSession(GameSessionRequests.RetrievedSessionData)

    Update a player session from data retrieved from GameSessionRequests.GetGameSessionsRequest

    Declaration
    public static void UpdateSession(GameSessionRequests.RetrievedSessionData data)
    Parameters
    Type Name Description
    GameSessionRequests.RetrievedSessionData data

    The data to update

    UpdateSession(PlayerSessionRequests.RetrievedSessionData)

    Update a player session from data retrieved from PlayerSessionRequests.GetPlayerSessionsRequest

    Declaration
    public static void UpdateSession(PlayerSessionRequests.RetrievedSessionData data)
    Parameters
    Type Name Description
    PlayerSessionRequests.RetrievedSessionData data

    The data to update

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 25 September 2020