Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't return a reference of any kind via JSON-RPC.</p> <p>There is no standard to do so (afaik) because RPC is stateless, and most developers prefer it that way. This simplicity is what makes JSON-RPC so desirable to client-side developers over SOAP (and other messes).</p> <p>You could however adopt a convention in your return values that some JSON constructs should be treated as "cues" to manufacture remote "object" proxies. For example, you could create a modified JSON de-serialiser that turns:</p> <pre><code>{ "__remote_object": { "class": "Some.Remote.Class", "remote_id": 54625143, "smd": "http://domain/path/to/further.smd", "init_with": { ... Initial state of object ... } } } </code></pre> <p>Into a remote object proxy by:</p> <ul> <li>creating a local object with a prototype named after <code>class</code>, initialised via <code>init_with</code></li> <li>downloading &amp; processing the <code>smd</code> URL</li> <li>creating a local proxy method (in the object proxy) for each procedure exposed via the API, such that they pass the <code>remote_id</code> to the server with each call (so that the server knows which remote object proxy maps to which server-side object.)</li> </ul> <p>While this scheme would be workable, there are plenty of moving parts, and the code is much larger and more complicated on the client-side than for normal JSON-RPC.</p> <p>JSON-RPC itself is not well standardised, so most extensions (even SMD) are merely conventions around method-names and payloads.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload