tzickel / launcher-plugin-specification

0 stars 1 forks source link

Suggestion: JSON-RPC method namespace #4

Open cpriest opened 6 years ago

cpriest commented 6 years ago

Add a namespace field the JSON message to namespace the method calls.

For example, all messages from the specification might be "lp-spec.01"

This way:

tzickel commented 6 years ago

There are 2 questions here:

  1. What should be passed in the negotiation part at startup (currently the server sends a list of apiversions and the client selects one, but maybe it could select a few?).
  2. How to encode versioning of specific Messages (which convey a flow from a specific version of the specification), I am leaning towards encoding the version / namespace in the message name itself (or maybe in the http headers as a content-type).
cpriest commented 6 years ago

I'm not familiar with the JSON-RPC spec, but based on the example in your main document, can we just add a namespace root-level parameter?

tzickel commented 6 years ago

The spec is as linked in the document: https://en.wikipedia.org/wiki/JSON-RPC#Usage The reason to follow it is that there are tons of libraries for many languages which implement this way of talking, for example vscode-jsonrpc package: https://github.com/tzickel/lps-playground/blob/master/nodejs/pluginbridge.js#L55 Gives us with zero effort the ability to parse and handle this communication method.