Table of Contents
The TwistedWeb service allows calls to one-way and two-way methods on game entities. These can be made using the request paths as described above.
This chapter gives more details about format of the arguments in the query string, the returned results and the supported types.
Any method of a base entity can be called whether it is exposed to clients using the <Exposed/> tag or not. The method name is the last part of the URL before the parameter list (i.e. before any ? character). Care must be taken to ensure that general access to call methods on the TwistedWeb service is not given.
To call a method on a cell entity, first call a method on a base entity that returns the result of a call on the cell entity.
The arguments are passed as URL parameters. All arguments are named
and so must be named in the entity's .def
file.
Not all types are supported. Supported types include:
-
All integer types - INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32 and UINT64
-
All float types - FLOAT32 and FLOAT64
-
All string types - STRING, UNICODE_STRING and BLOB
-
VECTOR2, VECTOR3 and VECTOR4
-
Sequence types - ARRAY and TUPLE of these types except for other sequence types
UNICODE_STRING parameters should be percent-encoded for UTF-8, such as:
myString=Japanese%20translation%3A%20%E6%96%87%E5%AD%97%E5%8C%96%E3%81%91
This string will result in the argument:
Japanese translation: 文字化け
BLOB parameters should be passed as a hexidecimal representation, for example:
myBLOB=aca3a6
VECTOR2, VECTOR3 and VECTOR4 should be passed as a comma separated sequence of floats, for example:
myVector=0.1,3.5,-6
Sequences can be passed in two ways - either as repeated arguments:
myArray=4&myArray=53
or as indexed arguments:
myArray[0]=4&myArray[1]=53
Return values are returned as a JSON document of name/value pairs.
These are encoded using the Python json module. Any
type that can be converted with this module can be used. Additionally
Vector2
, Vector3
, Vector4
and
PyArrayDataInstance
data types are converted to Python lists
before this conversion.
It is also possible to call one-way methods. On success, the following object is always returned.
{"message": "One way call made"}
Errors are returned as a specially formatted JSON object with an "excType" attribute. Refer to TwistedWeb Error handling for more information.