ZMQ based JSON-RPC server, with an additional letters soup
This project is just starting... The stuff placed here was manually tested and seems to work, but it has to evolve. There are so many lines that must be refactored: it's missing OOP, it lacks from automated tests, and so on.
In the future, I hope this will be an implementation of JSON-RPC based server in MATLAB, and perhaps a client to...
I will make an effort to isolate the transport mechanism (now ZMQ) from the server itself, and rename this repo to matlab-rpc
It's just as simple as downloading the coding and putting the folder in the matlab path...
This project make use of two very good libraries jsonlab and matlab-zmq. Please make sure they are in the path, and consider using require.m.
Create a folder named sandbox
in the same level that the root folder for this project. Inside this folder put *.json
files describing which functions may be called by RPC. These files must have the same name than the function, except from extension, and have two properties: params
and result
. params
should be an array with the name of the parameters for the function and result
should be an array with the name of the variables returned by the function.
For example:
* MATLAB
|
|--* sandbox
| |
| `-- int2str.json
|
`--* matlab-zmqrpc
// int2str.json
{
"params": ["X"],
"result": ["S"]
}
After doing this, starting the server should be enough to allow remote call of int2str built-in function:
zmqrpc.server
This work is very experimental and unstable... Any feedback you can give me on this would be gratefully received (see section Reporting a Bug at CONTRIBUTING). Please, make yourself comfortable in contributing 😊.
I love contributions! Please have a look at CONTRIBUTING and consider help me with the bellow stuff:
- Refactor code, making it OOP
- Abstract transport mechanism
- Implement a mechanism of registring handles (including namespaces)
- Isolate
Sandbox
, as an option for handle - Have a deep look at fileexchange/jsonrpc2 and see if we can borrow something from there.