Constructor
new Session(jt, id)
Create a Session.
CALLED FROM:
- Session#load
- Data#constructor
- Data#createSession
Parameters:
Name | Type | Description |
---|---|---|
jt |
Object | Server object. |
id |
type | The id of the new session. |
- Source:
Members
allowAdminClientsToPlay
Whether or not admin windows can play.
Generally, during testing this can be test
- Source:
allowNewParts
Whether or not clients can create a participant that does not exist yet.
- Source:
apps :Array
The apps in this session.
Type:
- Array
- Source:
clients :Array
A list of the clients connected to this session.
Type:
- Array
- Source:
options :Array
The options of this app.
Type:
- Array
- Default Value:
- []
- Source:
optionValues :Object
The option values of this app.
Type:
- Object
- Default Value:
- {}
- Source:
outputHide :Array
A list of fields to hide from output.
Type:
- Array
- Source:
participants :Object
A list of participants in this session.
Type:
- Object
- Source:
timeStarted :number
The time at which this session was last started.
Type:
- number
- Source:
Methods
(static) load(jt, json) → {Session}
Loads a session from a .json file.
FUNCTIONALITY
- create a new session
- load session objects from .gsf file
- for each object in the .gsf file, call the appropriate object.load method.
- link participants and players.
Parameters:
Name | Type | Description |
---|---|---|
jt |
Object | The server |
json |
type | The content of the session. |
- Source:
Returns:
The session described by the contents of json.
- Type
- Session
addApp(appId)
Add the app with the given ID to this session.
FUNCTIONALITY:
- load the given app Session#loadApp
- add app to this session's apps field.
- copy app source files Utils#copyFiles.
- save app and its stages App#saveSelfAndChildren.
- emit 'sessionAddApp' message.
Parameters:
Name | Type | Description |
---|---|---|
appId |
string | The ID of the app to add to this session. |
- Source:
addClient(socket, participantId)
Connect a web socket client to a participant of this session.
- Listen for disconnect and goto-next-stage messages.
- Load participant.
- Socket listens to its own channel.
-
CALLED FROM
- SocketServer#addParticipantClient
Parameters:
Name | Type | Description |
---|---|---|
socket |
Object | The web socket. |
participantId |
string | The id of the participant. |
- Source:
addParticipants(num)
Adds a particular number of participants to this session.
Parameters:
Name | Type | Description |
---|---|---|
num |
number | The number of participants to add. |
- Source:
advanceSlowest()
Move slowest participants to their next stage. See Participant#moveToNextStage.
- Source:
appFollowing({@link)
Parameters:
Name | Type | Description |
---|---|---|
{@link |
App} app The reference app. |
- Source:
Returns:
App The app in the session app sequence that follows the reference app.
clientRemove(socket) → {type}
clientRemove - description
Parameters:
Name | Type | Description |
---|---|---|
socket |
type | description |
- Source:
Returns:
description
- Type
- type
deleteApp(d)
this - description
Parameters:
Name | Type | Description |
---|---|---|
d |
type | description |
- Source:
emit(name, d)
Sends a message to all clients of this session.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the message. |
d |
Object | The data of the message. |
- Source:
getApp(participant)
Return the next app in the session for this participant, null if there are no more apps for this participant.
Parameters:
Name | Type | Description |
---|---|---|
participant |
Participant |
- Source:
messageCallback()
// * Process a message from the queue.
//
- Source:
outputFields() → {type}
this - description
- Source:
Returns:
description
- Type
- type
participant(participantId) → {type}
participant - description
Parameters:
Name | Type | Description |
---|---|---|
participantId |
type | description |
- Source:
Returns:
description
- Type
- type
participantCreate(pId) → {type}
participantCreate - description
Parameters:
Name | Type | Description |
---|---|---|
pId |
type | description |
- Source:
Returns:
description
- Type
- type
participantEnd(participant) → {type}
Overwrite to add custom functionality.
Parameters:
Name | Type | Description |
---|---|---|
participant |
type | description |
- Source:
Returns:
description
- Type
- type
participantMoveToNextApp(participant) → {type}
Parameters:
Name | Type | Description |
---|---|---|
participant |
type | description |
- Source:
Returns:
description
- Type
- type
playerRefresh(p) → {type}
Updates client with latest stage information.
Parameters:
Name | Type | Description |
---|---|---|
p |
type | description |
- Source:
Returns:
description
- Type
- type
pushMessage(obj, da, funcName)
Pushes a message to the end of the message queue.
Parameters:
Name | Type | Description |
---|---|---|
obj |
type | The client from whom the message was received. |
da |
type | The data received from the client. |
funcName |
string | The name of the function to evaluate on the client object. |
- Source:
removeParticipants(num)
Remove a particular number of participants from this session.
Parameters:
Name | Type | Description |
---|---|---|
num |
number | The number of participants to remove. |
- Source:
save() → {type}
this - description
- Source:
Returns:
description
- Type
- type
sendParticipantPage(req, res)
Sends a page to a client (via the given HTTPResponse object).
Parameters:
Name | Type | Description |
---|---|---|
req |
HTTPRequest | description |
res |
HTTPResponse | description |
- Source:
setNumParticipants(num)
Sets the number of participants in this session.
Parameters:
Name | Type | Description |
---|---|---|
num |
number | The number of participants to have. |
- Source:
shell() → {type}
shell - description
- Source:
Returns:
description
- Type
- type
shellWithChildren() → {type}
Creates a top-down shell of this Session. This includes all fields given by Session.outputFields, the participants, the apps and the clients.
CALLED FROM:
- Msgs#openSession.
- Source:
Returns:
The shell of this session.
- Type
- type
tryToEnd() → {type}
tryToEnd - description
CALLED FROM:
- Participant.endSession()
- Source:
Returns:
description
- Type
- type