How to make proper server connection without storing client URLs on the server


I am implementing a rather simple communicator – one broadcast chat and multiple others for private messaging between users/clients. The purpose of this app is educational and I want to use solutions that are (preferably:)) simple yet modern, flexible, and used in real life, I started implementation using RestController and I stored clients’ URLs in the database but I quickly understood that this is not good practice. I want to ask about links and resources that may address the following questions:

  1. How to make a flexible and secure connection between server and client without storing the latter URL?
  2. What is the correct protocol for information exchange in this kind of application


One way to make a flexible and secure connection between a server and its clients without storing their URLs is to use WebSockets. WebSockets is a protocol that allows for full-duplex communication between a server and its clients. This means that the server and the clients can both send and receive messages at the same time, and the connection remains open until it is closed by one of the parties.

Using WebSockets, the server can send messages to specific clients or broadcast messages to all connected clients. This allows for both private messaging and broadcast chat functionality in your application.

You can use a WebSockets library such as for Java ( This library makes it easy to set up WebSockets on the server and handle incoming and outgoing messages from clients.

Some resources that may be helpful for learning more about WebSockets and implementing:

Answered By – Hugo Dias

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published