Skip to main content

🛜 Ping

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.

URL Endpoint​

/sessions/ping/

Parameters​

NameRequired?TypeDescription
game_idYesstringThe ID of your game.
usernameYesstringThe user's username.
user_tokenYesstringThe user's token.
statusNostringSets the status of the session.

Valid Values for status​

ValueDescription
activeSets the session to the active state.
idleSets the session to the idle state.

Returns​

NameTypeDescription
successbooleanWhether the request succeeded or failed. Example: true
messagestringIf the request was not successful, this contains the error message. Example: Unknown fatal error occurred.

Syntax​

/sessions/ping/?game_id=xxxxx&username=myusername&user_token=mytoken
/sessions/ping/?game_id=xxxxx&username=myusername&user_token=mytoken&status=active

Request Example​

GET https://api.gamejolt.com/api/game/v1_2/sessions/ping/
?game_id=1
&username=hjake
&user_token=404432
&status=active
&signature=af8b72e5668e2175a024220b2401869e
HTTP/1.1
Host: api.gamejolt.com

Errors​

Affected parameterDescriptionError message
noneNo open session exists, open a new one!Could not find an open session. You must open a new one.

Version history​

VersionDescription
1.0First implementation