Info Query v7 - nodeGame/nodegame GitHub Wiki

  • status: complete
  • version: 7.x

The Info Query allows for the extraction of information about the state of the server via a REST API call.

Usage and Examples

Assuming your server runs on localhost and port 8080, you can execute an info query accessing the following url:

http://localhost:8080?q=PARAMETER

where PARAMETER can take any of the following values:

channels

Returns high-level information for every active channel.

Call:

http://localhost:8080?q=channels

Return value:

{
    "ultimatum": {
        "sockets":{"sio": true, "direct": true },
        "accessDeniedUrl":"/ultimatum/unauth.htm",
        "verbosity":100,
        "getFromAdmins":true,
        "enableReconnections":true,
        "defaultChannel":false,
        "name":"ultimatum",
        "roomCounter":2,
        "gameName":"ultimatum",
        "open":true
    }
}

games

Returns detailed information about the game played in every channel.

Call:

http://localhost:8080?q=games

Return value:

{
    "ultimatum": {
        "dir": "path/to/dir/game",
        "info": { }, // Content of package.json
        "settings": { // As in game.settings.js
            "standard": { },
            "pp": { }
        },
        "treatmentNames": ["standard","pp"],
        "setup": { },            // As in game.setup.js
        "stager": { },           // Game sequence.
        "languages":{ },         // Any languages supported.
        "channel": { },          // As in channel.settings.js
        "waitroom":{ },          // As in waitroom.settings.js
        "auth":{ },              // As in auth.settings.js
        "requirements":{ },      // As in requirements.settings.js
        "aliases":{}             // If any defined
    }
}

info

Returns combined info for active games and channels.

Call:

http://localhost:8080?q=info

Return value:

{
    "channels": {
        "ultimatum": {  } // See ?q=channels
    }
    "games": {
        "ultimatum": {  } // See ?q=games
    }
}

waitroom

Returns current status of waiting rooms.

Call:

http://localhost:8080?q=waitroom&game=ultimatum

Select the waiting room of a particular level within the game:

http://localhost:8080?q=waitroom&game=ultimatum&level=level2

Return value:

{"nPlayers":0} // Players currently waiting.

Enabling Info Query

The Info query is disabled by default. To enable the server configuration (conf/servernode.js) file inside the nodeGame installation folder and add the following line:

servernode.enableInfoQuery = true;

Cyclic Structures

In case of cyclic structures (e.g., a loaded database in game.setup.js) an error will be raised.

Go Back to

⚠️ **GitHub.com Fallback** ⚠️