petkopara petkopara - 1 year ago 80
Java Question

Can web server send data to desktop application without request?

I have several PC's on each of them I set small swing application that get data with JSON request to one web server. Can I receive the data from web server without to send request to the web server, with other words can the Web server send the data without the Java application to ask for this?

Answer Source

If you have enough server resources you can consider usage of websockets.

Every PC can open a socket to the server. When you open the socket you need to send to the server, the pc's unique ID. Then you need to store this ID in some database or file that will contain all online pc's and sockets .

Then the Server will be aware which pc's are online and which socket to use to communicate with this pc. After this you can send whatever information you need to this PC depending on your application.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download