Show / Hide Table of Contents

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).

Inheritance
System.Object
Service
Sessions
Inherited Members
Service.Api
Service.Wrap(Task<Response>, Action<Response>)
Service.Wrap<T>(Task<Response<T>>, Action<Response<T>>)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: GameJolt.Services
Assembly: GameJolt.dll
Syntax
public sealed class Sessions : Service

Methods

| Improve this Doc View Source

Check(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.

| Improve this Doc View Source

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>
| Improve this Doc View Source

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.

| Improve this Doc View Source

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>
| Improve this Doc View Source

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.

| Improve this Doc View Source

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>
| Improve this Doc View Source

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.

| Improve this Doc View Source

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>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX