I would like to develop a desktop application with Java (I've got very basic knowledge of Java). It'll run on the client's computer and will pull information from the server hosted in the internet. I can set a schedule task to connect to the server every 2minutes and check for any update/changes but I don't think it's a very good idea. Is there any way to let the clients know about the changes? For example, when every there would a change server will send a notification to the clients to update? The server might a different technology e.g. Java
any help would be greatly appreciated, thanks again!
Pushing to clients is always going to be hard - largely because of firewalls. Making the client pull from the server (with HTTP) is much more likely to work in most situations.
Now, you're currently polling every two minutes. That may be appropriate - or it may be better to do it much more rarely (once a day, say) depending on what you're updating. If it's updates to the client software, rare updates are fine. If it's updates to a chat conversation, even two minutes is far too long - in which case you should look into comet / long polling as a technique. (There are various technologies for implementing long polling; you don't have to use anything specific - that's why I described it as a technique rather than anything else.)
You can use JMS to send messages from your server to your applications if you use a Java Server.
Or you could use a Comet application to push messages to the clients via HTTP.
A third way would be to create your own push system where your clients connect to the server to give some informations on how to be contacted, and with the Observer/Observable pattern you notify every client at each modification.
Resources :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With