Experience:
A while back, I was involved in developing a Java Server-Client application for building automation purposes. Initially, we used Java RMI to connect the server and client but soon realized that utilizing JavaScript for the client side would be more advantageous for various reasons.
Since RMI didn't work between JavaScript and Java, we opted for WebSockets for establishing a near real-time connection. This was approximately 3 years ago when WebSockets were still in beta stage with minimal documentation and incomplete functionalities. To bridge this gap, I devised my own JSON-based RMI protocol where incoming JSON objects from the client were deserialized and processed by my server application using java.lang.reflection to execute the desired methods.
Fortunately, the system worked efficiently as I designed it to be quite flexible, allowing dynamic insertion of subclasses at runtime without compromising functionality.
Inquiry:
I have always pondered whether there exists a standardized approach to integrate Java with JavaScript similar to RMI (maybe extending an interface and accessing these methods via JavaScript). Surely, I can't be the only one grappling with this challenge.
About Me: As an electrical engineer by profession, my knowledge of Java, JavaScript, and web technologies is mainly self-taught. While I am well-versed in Java concepts, JavaScript is relatively new territory for me.