Currently all the JSON-RPC handling between GobPie and Goblint has been hand-rolled on top of a socket, JSON (de)serialization and manual reading/writing. As the number of requests increases (especially for CFG and state lookups), there will be many requests and their responses will have to be associated by ID to return them to the right places.
Instead of reinventing the wheel, we should just use lsp4j's JSON-RPC support which MagPie itself uses as well. This should allow calling JSON-RPC methods just like calling any other Java method (and the library takes care of the rest), putting the RPC into JSON-RPC for real. It also implements distributing incoming responses by ID to their callers via CompletableFuture, so instead of blocking socket reads there is asynchronicity.
Currently all the JSON-RPC handling between GobPie and Goblint has been hand-rolled on top of a socket, JSON (de)serialization and manual reading/writing. As the number of requests increases (especially for CFG and state lookups), there will be many requests and their responses will have to be associated by ID to return them to the right places.
Instead of reinventing the wheel, we should just use lsp4j's JSON-RPC support which MagPie itself uses as well. This should allow calling JSON-RPC methods just like calling any other Java method (and the library takes care of the rest), putting the RPC into JSON-RPC for real. It also implements distributing incoming responses by ID to their callers via
CompletableFuture
, so instead of blocking socket reads there is asynchronicity.