Class: Session#

A session is describes a real-time interaction between a group of one or more players. Sessions can be public or private with the members being able to freely join or requiring direct invitation by the session host. The Session object contains metadata specific to the product for purposes of state initialization and synchronization. Note that the session is not intended to replace a real-time communication server but instead be used as a metadata description of such a discrete server instance.

Visibility#

Each session has a visibility property. That visibility property determines whether or not the session can be included in public searches for sessions. The value of the visibility property is an enumerator with the following possible values.

  • PUBLIC - A session which is considered public. Anyone can freely join. If a password is set, then only those whom provide the correct password may join.

  • FRIENDS_EXTENDED - A session which is considered private. Immediate friends of the host as well as their friends may freely join.

  • FRIENDS_ONLY - A session which is considered private. Only immediate friends of the host may freely join.

  • INVITE_ONLY - A session which is considered private. Only those that have been explicitly invited may join.

  • LOCKED - A session which cannot be modified or joined after creation. This visibility is often used by other systems such as matchmaking or tournaments.

Session Hosts#

The session may optionally also set a hostUid. The host is a designated user, often the user that created the session, that has the power to make modifications to the session. If no host is specified then any member of the session can make modifications.

Session Data#

The data property provides a means of setting arbitrary information about the session that is product specific. This may be useful to encode such information as the selected game mode, map, rules, time limits or other that the game server will use once the session begins.

Status#

The status property is used to indicate the current state of the session. The value is encoded as an enumerator with the following possible values.

  • WAITING_FOR_PLAYERS - The session is currently waiting for players to join.

  • IDLE - The session is currently in an idle state where the players are not actively engaged in real-time interaction. This may be because they are in a lobby or post-session screen.

  • IN_PROGRESS - The session is currently in progress with active real-time interaction amongst the players.

  • ENDED - The session has completed with all players having left and no longer actively participating.

Type#

The type property must be unique per session host. It describes the type of session. Typically this is a GAME, LOBBY, PARTY or WORLD. Only one session can be created per combination of type and hostUid.

REQUIRES: Session Services

author Jean-Philippe Steinmetz info@acceleratxr.com

Hierarchy#

Index#

Constructors#

Properties#

Accessors#

Constructors#

constructor#

+ new Session(other?: any): Session

Overrides EntityBase.constructor

Defined in src/models/Session.ts:168

Parameters:#

Name

Type

other?

any

Returns: Session

Properties#

data#

data: any

Defined in src/models/Session.ts:97

The map of arbitrary data associated with the session.


dateCreated#

dateCreated: Date = new Date()

Inherited from EntityBase.dateCreated

Defined in src/EntityBase.ts:18

The date and time that the object was created.


dateModified#

dateModified: Date = new Date()

Inherited from EntityBase.dateModified

Defined in src/EntityBase.ts:23

The date and time that the object was last modified.


hostUid#

hostUid: string = “”

Defined in src/models/Session.ts:104

The UUID of the host user that owns the session. If no host is specified then the session is considered to be owned by the system itself. When a session has no host any member may modify the session data. If a host is specified then only that user may modify the session data.


invited#

invited: Array<string> = []

Defined in src/models/Session.ts:109

The list of UUIDs for each user that has been invited to the session by the host.


mode#

mode: string = “realtime.SessionMode”

Defined in src/models/Session.ts:116

The default type of mode that will be used.

REQUIRES: Session Services


numTeams#

numTeams: number = 0

Defined in src/models/Session.ts:121

The total number of teams represented in the session.


password#

password: string = “”

Defined in src/models/Session.ts:126

The secret password that must be given in order to join the session.


productUid#

productUid: string | undefined = undefined

Defined in src/models/Session.ts:133

The uid of the product that this definition is associated with.

REQUIRES: Session Services.


serverUrl#

serverUrl: string = “”

Defined in src/models/Session.ts:138

The connection URL of the session server associated with the session.


status#

status: SessionStatus = SessionStatus.WAITING_FOR_PLAYERS

Defined in src/models/Session.ts:143

The current activity state of the session.


teamSize#

teamSize: number = 0

Defined in src/models/Session.ts:153

The maximum number of players allowed per team.


teams#

teams: Array<Team> = []

Defined in src/models/Session.ts:148

The list of teams, containing player assignments, for the session.


type#

type: SessionType = SessionType.GAME

Defined in src/models/Session.ts:158

The type of session.


uid#

uid: string = uuid.v4()

Inherited from EntityBase.uid

Defined in src/EntityBase.ts:13

The universally unique identifier of the object.


users#

users: Array<string> = []

Defined in src/models/Session.ts:163

The list of UUIDs for each user actively joined to the session.


version#

version: number = 0

Inherited from EntityBase.version

Defined in src/EntityBase.ts:28

The optimistic locking version of the object.


visibility#

visibility: SessionVisibility = SessionVisibility.PUBLIC

Defined in src/models/Session.ts:168

The visibility of the session within the global roster.

Accessors#

ClassName#

Staticget ClassName(): string

Defined in src/models/Session.ts:92

Returns: string