PGilbert wrote:If one could maintain a JSON variable to be the same in the APL WS and the Web app that would be enough for us.
When you say "JSON Variable" I'll assume you intend that an object graph should be kept synchronised on both sides of the fence: on one side you have a nested array (or more generally a tree of namespaces containing nested arrays) and on the other side you have a "javascript object" (or at least the subset which could be serialised as JSON).
First of all, let's remember that Javascript and nested arrays have a different domain: in Javascript there are no arrays of rank greater than 1, for instance. So let's also assume that only the subset of nested arrays which can be turned into JSON using the []JSON primitive will be supported.
A trivial implementation would marshal everything for every change. This would be hardly noticeable for small objects but unbearably expensive for large trees. Notice that this is already possible using variable triggers on the side of Dyalog and proxies (
https://developer.mozilla.org/en-US/doc ... ects/Proxy) on the side of Javascript. There are, indeed, Javascript frameworks based on proxies.
In case one cared about performance, one would need to send only deltas to changes. Proxies and triggers, once again, could be used to build a prototype where only deltas are exchanged, as far as I understand the problem.
Notice that, in general, Dyalog and the Javscript engine of the HTMLRenderer have separate and independent execution threads and they could both change the same element of the same array at the same time in different ways and the protocol would have to decide what to do with conflicts (in the same way you have to deal with conflicts when you merge code coming from different origins).
Once you have the data magically transferred from Dyalog to Javascript (or vice versa) you'd still have to have a mechanism to inform the rest of the application that a change has occurred. So, I imagine, you'd have to subscribe, on both sides, to callbacks, unless you expect a certain direction of flow to be preferential (like from Dyalog to Javascript) in which case you'd be ready to manually inform you web app that the data has changed and that something should happen. But if this is the case, I guess you'd be better off sending the data along with the method invocation that causes the refresh of the GUI.
Is this along the lines of what you had in mind?