4 ms·
Feels very similar to JSON RPC. This isn't a script at all but a way to call an RPC method. And over a non duplex connection at that. I often use something ve
by prawnsalad 10y ago
Feels very similar to JSON RPC.
This isn't a script at all but a way to call an RPC method. And over a non duplex connection at that.
I often use something very similar with a few additions to support callbacks. Add an ID field so that responses can be matched and you suddenly support calls being made over a duplex connection such as Websocket or TCP connection;
Shorthand and longhand formats complicate things so stick with one type. The whole $ prefixed params are also un-needed, especially if your'e expecting them and have the important values under your own expected keys anyway.
But then after all this you start turning into json-rpc.
- epoberezkin 10y agoThanks for the comparison. JSON-RPC allows simple batching but it doesn't allow any server side logic between calls. Individual calls to external instructions in JSONScript are indeed similar. The full syntax can be used if you need to evaluate some of the fields, it's also easier to parse. Short syntax is implemented as a macro - it's expanded to full syntax before evolution. Given that it in most cases short syntax is better I was going to hide full syntax a bit...
- epoberezkin 10y agoRe '$', there is no expectation on the location of the script instructions in the object structure, unlike JSON RPC. So it is used to differentiate instructions from simple data structures that can be part of the script.