is fairly simple. Client sends a request and server sends response (message). The data is traveled on top of the TCP connection initiated by client.
is ruled by serialization methods; by default the serialization
module
implementation is used. The following is the default message protocol.
Every message (back and forth) is:
- a message body length in text format followed by the '\n' character;
- message body of exactly the declared length in text format.
The message body is the Lua table declaration in array form. The array can have elements of the following types:
- strings in double quotes
- numbers
- booleans (false, true)
- tables in a declaration form.
Generally the message body is ready for loadstring()
is an array table:
[1]
object reference[...]
args
The object reference may be:
- a table reference
- a function reference
- any other reference (see details below)
- tango API function name (starting with
tango.
)
In case it is a table field then:
- [...] == nil -> get the value
- [...] ~= nil -> set the value to [2]
In case it is a function it is called with [...] as arguments.
With other Lua objects which (besides tables and functions) are userdata and thread the behavior is currently undefined.
All object references match the pattern TYPE: iD
Tango API names are simple symbolic tango.APIFUNC
. Functions called
with [...] as arguments.
is also an array table:
[1]
is the boolean indicating if the request succeeded or not[...]
either the return value of the request or the error message
Client:
25
{"function: 0x98765",1,2}
Server:
8
{true,3}
This is how the client asks server to call the function add(1,2)
on the
server side and receives the response 3