PlayerIO

The fastest way to build online games without breaking a sweat.

HTML5 (Javascript) Client Reference

javascript (html5) PlayerIO class informationClass PlayerIO

Language: Javascript (HTML5)

Main class for authenticating a user and getting a client.

Example

Here is an example of using the class to authenticate:

Properties

 
PlayerIO.quickConnect :

Access the QuickConnect service

PlayerIO.useSecureApiRequests :bool

If set to true, all API Requests will be encrypted using TLS/SSL. Be aware that this will cause a performance degradation by introducting secure connection negotiation latency for all requests.

Methods

 
PlayerIO.authenticate (gameId, connectionId, authenticationArguments, playerInsightSegments, successCallback, errorCallback):

Authenticates a user to Player.IO. See the Authentication documentation on which authenticationArguments that are needed for each authentication provider.

PlayerIO.gameFS (gameId):

Get a gameFS instance for a specific game (only use this method when you don't have a valid client).

PlayerIO.quickConnect

PlayerIO.quickConnect :

Access the QuickConnect service

PlayerIO.useSecureApiRequests

PlayerIO.useSecureApiRequests :bool

If set to true, all API Requests will be encrypted using TLS/SSL. Be aware that this will cause a performance degradation by introducting secure connection negotiation latency for all requests.

PlayerIO.authenticate

PlayerIO.authenticate (gameId, connectionId, authenticationArguments, playerInsightSegments, successCallback, errorCallback):

Authenticates a user to Player.IO. See the Authentication documentation on which authenticationArguments that are needed for each authentication provider.

Arguments

gameId:string
The game id of the game you wish to connect to. This value can be found in the admin panel.
connectionId:string
The id of the connection, as given in the settings section of the admin panel. 'public' should be used as the default
authenticationArguments:object
A dictionary of arguments for the given connection.
playerInsightSegments:object
Custom segments for the user in PlayerInsight.
successCallback:function(client)
Callback function that will be called with a client when succesfully connected
errorCallback:function(PlayerIOError)
Callback function that will be called if an error occurs

PlayerIO.gameFS

PlayerIO.gameFS (gameId):

Get a gameFS instance for a specific game (only use this method when you don't have a valid client).

Arguments

gameId:string
The game id of the game you wish to access.