From Arnaud Bouchez on LinkedIn
I don’t like switching and pipeling protocols.
With our mORMot framework, we achieve the same goals, just staying with plain JSON.
- It can use WebSockets (in addition to regular REST/HTTP) and gather pending requests and responses into a JSON array, to reduce latency - and still be simple and standard.
- Both ends agree with a contract, which is defined as a modern object pascal “interface” type. No IDL, no separated file, no XML. Just code. Then its generates a JSON array of values instead of a JSON object of name:value pairs. The JSON array is sent as both requests and responses as standard WebSockets JSON frames. We could optionally use a WebSockets binary frame (with this JSON array payload but optional compression and encryption), for even smaller TCP packets, without the complexity of HTTP/2. And our JSON parser/emitter works at 1GB/s per core so with very high performance. Network is the bottleneck.
- Type safety is built from the object pascal language, and its “interface” type definition.
- It is still plain JSON, so it is much more standard that your “polyglot” solution. Try to implement gRPC and IDL with plain JavaScript. You need a library. JSON is embedded to the browser.
- WebSockets frames are by definition bi-directional. If you define an “interface” method with no result parameter, it could be identified as “non-blocking sending with no wait”. Just awesome for event-based systems.
- You can generate client code for any language or system, using a mustache template system (e.g. into C# or into a Swagger template). It uses a standard WebSockets stream, so you can share the same proxy/load balancer system already used for your HTTP requests.
- It is not “more complex”. It is just a simple but clever solution leveraging plain JSON and WebSockets.
- It is perfectly human readable, as JSON is still used for the values.
- WebSockets and JSON are still part of the browser support. So you can use this scheme with front-end applications.
This is mORMot 1 documentation but it stays the same with current mORMot 2 version (documentation is a work in progress)