How to tie Java and web-interface?

The problem arose linked to a simple web interface written in html+css with a program written in Java.
At the moment the program consists of server and client that communicate via sockets using buffers. To better understand what this program is, you can imagine a normal echo server, the essence of which is that in the command line on the client side, enter message, server receives it and sends it back. Roughly speaking we need to make sure that the message the client was entered from the command line and web interface. How can I do that? (Options)
I would be grateful for your answers! :)
August 19th 19 at 23:38
3 answers
August 19th 19 at 23:40
Solution
you will need to slightly improve the backend to make it work, not just simple sockets and websockets, libraries like the full for all languages, so that any problems and changes the logic on the server side will not, especially if you don't have to protect this interface (i.e. it is not public)

as an alternative you need a Converter (proxy), the websocket ordinary sockets, this proxy will act as the server for your html page, write it will be even easier

accordingly, the html page will be the websocket to connect to your program, regular means html5+javascript
August 19th 19 at 23:42
AJAX <-> API
August 19th 19 at 23:44
REST

Find more questions by tags JavaComputer networksWeb Development