deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

Package deltachat-rpc-server to npm

Open link2xt opened this issue 1 year ago • 3 comments

Currently there are 3 ways to use JSON-RPC bindings from JavaScript:

  1. Use legacy node bindings https://github.com/deltachat/deltachat-core-rust/tree/4a0585404a0a5f2e3edb4257a69d63efeb199ef3/node with CFFI calls to submit JSON-RPC requests and receive responses. This is what Delta Chat desktop is currently doing.
  2. Experimental napi-jsonrpc at https://github.com/deltachat/napi-jsonrpc/, currently not maintained and archived, stuck at v1.115.0, unlikely to be supported in the future.
  3. Spawn a deltachat-rpc-server process and use StdioTransport to communicate with it without any binary API.

Eventually we would like to deprecate first approach and switch to the third approach. The disadvantage of using the stdio approach currently is that the core distributed in the form of deltachat-rpc-server cannot be automatically installed as a dependency with npm install.

To close this issue we need to package deltachat-rpc-server to npm, so a single package can be installed that provide an API to spawn bundled deltachat-rpc-server for the host architecture and provide a JSON-RPC client that can be used.

This issue is split out of more general #4524.

link2xt avatar Sep 08 '23 18:09 link2xt

cc @ralphtheninja @Simon-Laux

link2xt avatar Sep 08 '23 18:09 link2xt

do we have a deltachat-rpc-client equivalent for JavaScript? IIRC the bindings are generated automatically for javascript and that is what DC desktop uses? something similar to deltachat-rpc-server but not over standard IO but web socket or so?

adbenitez avatar Oct 16 '23 17:10 adbenitez

no desktop uses it over deltachat-node, then uses the bindings. the bindings don't care how you run or communicate with core, you just implement an interface for doing so and then you're ready to use the bindings: https://www.npmjs.com/package/@deltachat/jsonrpc-client

Simon-Laux avatar Oct 16 '23 18:10 Simon-Laux