How can I write a simple RPC server in Julia?
As far as I can see, I need the following parts:
- I/O transport (pipes / sockets / websockets / ZMQ / etc.)
- Serialization protocol (JSON / BSON / MsgPack / Protobuf), and RPC standard message format, like JSON-RPC or SOAP (e.g. what headers should be added, like endpoint name and message id).
- Some kind of multiplexer to route messages to corresponding endpoint functions.
With all that, I should be able to send messages to call API functions and receive responses from RPC server.
So I have a couple of questions about each part:
-
Can the same server API be used with differnt transport types? Or if some two applications use different transport, should I write an adaptor, like pipes to websockets, sockets to ZMQ, and so on?
-
There are many solutions for serialization and message format. What are most used and simple message formats for RPC, so I don’t need to reimplement custom RPC routing in every language that client or server may be written with?
-
I’ve found just a few possible solutions for RPC message multiplexer:
- HTTP.jl, using router and endpoint functions. What if I don’t need the whole HTTP protocol, but a fast and simple IPC communication using just sockets or pipes? Or, if I want to speed-up response time, can I wrap HTTP requests under a websocket connection?
- JuliaWebAPI.jl, seems like it can only use JSON as language-neutral serialization format, but message format is different from standard JSON-RPC. Also, the package looks abandoned (why)?
- gRPC.jl, looks abandoned and no documentation.
Are there any other Julia packages for biulding RPC API in different combinations of (1), (2) and (3), or should I just extend JuliaWebAPI for some other message formats?