Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push notifications for desktop apps?

Push notifications for mobile apps allow for some cool possibilities in terms of user experience. Are similar services available for desktop apps, such as those written in Java or C#?

My goal is to let the program take actions based on notifications from a server. If push notifications aren't available, what are some workarounds I could do? Have the program schedule itself as a task (either a cron job, or scheduled task, or w/e), then check the server for updates? Keeping the program running in the background at all times wouldn't be an option, because updates would be too infrequent.

like image 892
Nick Heiner Avatar asked Mar 24 '11 23:03

Nick Heiner


1 Answers

If you want push notifications, you don't have much choices other than having a process running at all times because the server would need a way to contact your application.

Using push notifications, you can either have a permanent connection with the server with sockets for example. When there is an update, the server would notify your application and you do whatever needs to be done.

However, if your updates are infrequent, a pull solution might be a better idea, because it wouldn't require a permanent connection.

Since your program doesn't need to be open all the time,

(Have the program schedule itself as a task (either a cron job, or scheduled task, or w/e), then check the server for updates? Keeping the program running in the background at all times wouldn't be an option, because updates would be too infrequent.)

you might just want to check with the server if an update is available at application startup (depending on your needs, hard to tell only with details from the question).

If you want, you might also add polling the server in a background thread wich checks for updates at a fixed interval (one that fits your needs).

like image 50
Martin Avatar answered Sep 28 '22 03:09

Martin