From Ape Wiki

Jump to: navigation, search

Contents

[edit] RAW

Data sent from server to client is called a RAW. Custom RAWs can be created to suit the needs of your applications. RAWs are sent as JSON objects. Knowing JSON is crucial for understanding RAWs.

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

  • received message
  • login
  • error
  • more...

[edit] RAW Formatting

RAWs are formatted as the following :

[
Object :
    raw:  <value>     <- This is the type of RAW
    time: <value>     <- This is went it happened (unix timestamp)
    data: <Object>    <- This contains the parameter(s) sent from server to client
]

The keys "raw", "time", and "data" are mandatory for all RAWs.


Below is an example RAW of type "LOGIN", as identified by the key "raw".

{"raw":"LOGIN","time":"1241917853","data":{"sessid":"fe9f5ee27889b8d67ff99d35b77aa12f"}}

This is the server acknowledging that the client has connected and assigns the client a session id (sessid).

[edit] Multiple RAWs

APE can also send multiple RAWs at once by placing them into a JSON array:

[
    {"raw":"LOGIN","time":"1241917853","data":{"sessid":"fe9f5ee27889b8d67ff99d35b77aa12f"}},
    {"raw":"IDENT","time":"1241917853","data":{"user":{"properties":{"name":"oozoy"},"casttype":"uni","pubid":"5150599277195552aa2aeb5f82f997e4"}}}
]

Here, APE sent the RAW "LOGIN" following by the RAW "IDENT".

Phenomenal berkadwon of the topic, you should write for me too!

[edit] Sending RAWs

The official APE SERVER > RAWs documentation explains how the APE server sends RAWs to the client.