Run a procedure in ThingsDB. A successful run request will respond with a
DATA (18) package.
[scope, procedure, ...args]
args are parsed (and must match) to the procedure.
The socket needs to be authorized before sending a
See the auth example for how to authorize a socket connection.
As an example we assume there is a procedure created in the
@thingsdb scope, called “add_one” which just adds one to a given value.
The procedure can be created using
new_procedure('add_one', |x| x + 1);, see new_procedure().
This is the data we want to pack:
["@t", "add_one", 41]
Serializing the above using MessagePack results in the following
Now we create the header. For this example we just use ID 0:
Sending the Query package
Responding Data package
We see that the
DATA response package has a header with attached data of length
Unpacking the data
* using MessagePack will return the expected value
42 which is the expected result.