I am looking to embark on a personal project involving a Java-coded server, an HTML
/JS
client (with a framework yet to be determined), and an Android
client.
My goal is to have the ability to call a Java
method from both clients using only one implementation. What approach could I take to achieve this?
Initially, I considered using Websocket
, but it appears that I can only send messages, requiring the server side to parse them and make method calls itself. While feasible, I am hoping to discover a more efficient solution.
Upon further research, I found that AJAX presents a similar challenge. A HTTP request is sent, necessitating a parser to interpret the request and distribute it accordingly.
Although servlets are capable of performing this task, they are often deemed outdated. I am unsure as to why this perception exists, however.
I am fully receptive to any suggestions for implementing seamless client-server communication.
EDIT: The ideal scenario would involve a system enabling direct method calls on the server from the client side. An optimal solution would entail the ability to call webservices from Javascript or utilizing a framework allowing direct remote calls to Java methods.