From Ape Wiki

Jump to: navigation, search

Contents

Commands

The APE Server is controllable via Commands sent by an external client (example: the APE JavaScript Framework). Custom Commands can be created to suite the needs of your application. Commands are sent as JSON objects. Knowing JSON is is crucial for understanding RAWs.

Here is a non exhaustive list of built-in Commands :

  • JOIN - Join a channel.
    e.g. [{"cmd":"JOIN","sessid":"4622c258248931a7dfb081542eaf589f","chl":1,"params":{"channels":["testChannel"]}}]
  • LEFT - Leave a channel.
    e.g. [{"cmd":"LEFT","sessid":"4622c258248931a7dfb081542eaf589f","chl":2,"params":{"channel":"testChannel"}}]
  • SEND - Send a message to a user, a channel, or anything else.
    e.g. [{"cmd":"SEND","chl":4,,"sessid":"c2cd0313eeea222b020b314e01dcb1fd","params":{"msg":"b","pipe":"bcfcbe2f29ce890fe30a16c5f1c0b60c"}}]
  • CHECK - Keep the connection alive.
    e.g. [{"cmd":"CHECK","sessid":"98092a5d9c967238c55c21ecb8af8948","chl":3}]
  • PROXY_CONNECT - Connect to an external server.
  • more...

Command Formatting

Commands are formatted as the following:

[
Object :
    cmd: <value>    <- This is the type of Command
    chl: <value>    <- This is the Challenge number. Spelt C-H-L. Starting value is one.
]

The keys "cmd" and "chl" are mandatory for all Commands. The Challenge number is incremented with every request sent to the server.


Example: Client connecting to APE server

[{"cmd":"CONNECT","chl":1}]

Multiple Commands

Multiple Commands can be sent at once by placing them into a JSON array:

[
    {"cmd":"COMMAND_NAME","chl":1,"sessid":"xxxxxx","params":{"foo":"bar}},
    {"cmd":"COMMAND...."}
]

Intercepting Commands

Commands can be intercepted by the server. See the official APE SERVER > Commands document for details.

Sending Commands

TODO. For now, see the official APE JSF documents for details.