[fpc-pascal] JSON RPC send server request to client

Hairy Pixels genericptr at gmail.com
Sun Oct 2 07:20:19 CEST 2022



> On Oct 2, 2022, at 10:23 AM, Hairy Pixels <genericptr at gmail.com> wrote:
> 
> So I need to send the message manually back to the client (the IDE) with the ID which JSON RPC requires also. I’m confused about the ID in particular and if it can be anything or it needs to be generated in the same stream as existing IDs.

Follow up, I sent the message by manually packaging it with the RPC protocol and made my own ID, which works but there is no way to get a response from the client in your library it appears (like you said this may just not be supported)

In LSP the client is sending back this response payload which has the ID of the request. I guess to implement this you would need to keep a list of sent requests by ID and then find their handler (like the method dispatcher for requests) and invoke with the “results” data.

interface ResponseMessage extends Message {
	id: integer | string | null;
	result?: string | number | boolean | object | null;
	error?: ResponseError;
}

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list