Class Sessions
Sessions are used to tell Game Jolt when a user is playing a game, and what state they are in while playing (active or idle).
Inherited Members
Namespace: GameJolt.Services
Assembly: GameJolt.dll
Syntax
public sealed class Sessions : Service
Methods
| Improve this Doc View SourceCheck(Credentials, Action<Response>)
Checks to see if there is an open session for the user. Can be used to see if a particular user account is active in the game.
Caution: GameJolt does not distinguish between a failed request due to an error and a request that doesn't succeed because there is no open session. You can indirectly check this by looking at the message field. If Success is false and a message is set, an error has occured. If Success is false and no message is set, the query has succeeded, but there just is no open session.
Declaration
public void Check(Credentials credentials, Action<Response> callback)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
System.Action<Response> | callback | Action that is called on completion or error. |
CheckAsync(Credentials)
Checks to see if there is an open session for the user. Can be used to see if a particular user account is active in the game.
Caution: GameJolt does not distinguish between a failed request due to an error and a request that doesn't succeed because there is no open session. You can indirectly check this by looking at the message field. If Success is false and a message is set, an error has occured. If Success is false and no message is set, the query has succeeded, but there just is no open session.
Declaration
public Task<Response> CheckAsync(Credentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response> |
Close(Credentials, Action<Response>)
Closes the active session.
Declaration
public void Close(Credentials credentials, Action<Response> callback)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
System.Action<Response> | callback | Action that is called on completion or error. |
CloseAsync(Credentials)
Closes the active session.
Declaration
public Task<Response> CloseAsync(Credentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response> |
Open(Credentials, Action<Response>)
Opens a game session for a particular user and allows you to tell Game Jolt that a user is playing your game. You must ping the session to keep it active and you must close it when you're done with it.
Declaration
public void Open(Credentials credentials, Action<Response> callback)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials for whom a session should be opened. |
System.Action<Response> | callback | Action that is called on completion or error. |
OpenAsync(Credentials)
Opens a game session for a particular user and allows you to tell Game Jolt that a user is playing your game. You must ping the session to keep it active and you must close it when you're done with it.
Declaration
public Task<Response> OpenAsync(Credentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials for whom a session should be opened. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response> |
Ping(Credentials, Boolean, Action<Response>)
Pings an open session to tell the system that it's still active. If the session hasn't been pinged within 120 seconds, the system will close the session and you will have to open another one. It's recommended that you ping about every 30 seconds or so to keep the system from clearing out your session. You can also let the system know whether the player is in an active or idle state within your game.
Declaration
public void Ping(Credentials credentials, bool active, Action<Response> callback)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
System.Boolean | active | Whether the user is active or not. |
System.Action<Response> | callback | Action that is called on completion or error. |
PingAsync(Credentials, Boolean)
Pings an open session to tell the system that it's still active. If the session hasn't been pinged within 120 seconds, the system will close the session and you will have to open another one. It's recommended that you ping about every 30 seconds or so to keep the system from clearing out your session. You can also let the system know whether the player is in an active or idle state within your game.
Declaration
public Task<Response> PingAsync(Credentials credentials, bool active)
Parameters
Type | Name | Description |
---|---|---|
Credentials | credentials | The user's credentials. |
System.Boolean | active | Whether the user is active or not. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Response> |