Your application does not rely on any standard protocol. Thus, you have to recreate the client from scratch using Javascript (to make it a web application). And it will be a problem to make direct socket connections from the browser using javascript (as soon as you exit the local connections, you will be under browser security restrictions).
As a scroll forward approach: start the server as a jar application and the client user applet (Oh !, this is 90 - 00's). And I think a year or two applets are becoming obsolete.
It would be better if you rewrote your application using something more standard, for example, STOMP via WebSockets. Your server can then be deployed to a servlet container, such as Tomcat or Jetty. And your client will be what supports websockets and STOMP.
From what I saw, your application has authentication and chats. It is better to deliver authentication and authorization to the user infrastructure (whatever, just provide additional headers in the connections on the network to combine the WS connection and the established session). And chats in STOMP words become destinations. Thus, you will need to create an application that responds to messages arriving at destinations.
I would recommend you take a look at the spring framework and its support for websockets.
In addition, I saw that you are establishing a separate database connection for each user session, which is generally a generous use of resources. Create a connection pool and use one of them only when necessary.
source share