On Tue, 4 Oct 2022, Hairy Pixels wrote:
On Oct 3, 2022, at 10:48 PM, Michael Van Canneyt via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:
FPC's JSON-RPC is designed to be used using HTTP(s) transport only, i.e.
synchronous request and answer.
Hence Ryan's failure to achieve what he wants to do.
But if changes need to be made to make it usable over other transports, then I
am open for suggestions. With the new support for websockets in FPC, this seems
like a good time to review the architecture.
In my experience making a Pascal language server using LSP
(https://microsoft.github.io/language-server-protocol/)l here are top issues
I’ve had:
1) As mentioned the server can’t send messages to the client or receive their
responses.
Seems like both parts in the LSP protocol are playing 'client' and 'server',
because:
"The Client is defined as the origin of Request objects and the handler of
Response objects.
The Server is defined as the origin of Response objects and the handler of Request
objects."
As usual one can trust Microsoft to give an own interpretation to a protocol :)
2) LSP has various “any” types which aren’t streamed currently. If TJSONData,
TJSONArray etc.. types were streamed this would be good enough probably.
This is not specifc to JSON-RPC, but to JSON streaming in general.
3) A minor issue is I wish dynamic arrays were streamed instead of the
TCollection types. They are easier to use and manage their own memory which is
nice.
It is since long on my TODO list:
The restbase unit (which already has this capability) needs to be unified with
the jsonstreamer unit.
Also on my TODO list are related things such as:
* a more complete JSON Schema implementation
and
* a Swagger (OpenAPI) output
and
* an input system to convert a swagger description to a class that handles an API.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal