Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
SharedState for object created on the client side
Hello,
I am in the following situation (given by 3rd party code that can't be changed) and I honestly do not know (from an architectural & implementation point of view) on how to resolve it.
I Need to implement an AbstractJavaScript extension. What I did was creating the serverside class and the javascript code with the method corresponding to the class name prefixed by the full package name, everything works fine, I can call Javascript from the server and the other way round.
The actual challenge:
On the Javascript side imagine a method that builds a Javascript object.
Now I somehow would need to create a class instance on the server side with a shared state for exactly this object. The object would have a method setValue on the JavaScript side that I want to be able to call from the serverside.
Basically inside my extension I create another object that I need to connect to the server:
window.my_custom_package_CustomClass = function() {
var myOtherObject = thirdParty.buildOtherObject();
// How to connect for RPCs?
}
Is there a way to do this?