Continuing the discussion from Required clicks per Button:
Sometimes having real-time notification could improve the work performance because the user can react quickly. Of course such notification should be use with care to not overflow users with useless notification.
A notification is a pop-up display above all other windows. Most desktop has this feature and also most of the browsers.
The challenge is having the client listening for the notification for the current user with a minimal resource consumption client and server sides.
We could use the long polling method. So the desktop client will start a new thread and the web client will start such query at login. They will make request on a specific address using the user ID and the session.
On the server side, we could use the LISTEN/NOTIFY mechanism to wait for notifications. For other back-ends which do not support such mechanism, the request will just return an error code and the client will not try any more.
We will created a channel for the user name and another for the session like that we could notify the user anywhere and only for a specific session (could be used with on_change).
On logout, the long polling should be stopped.
On web client, we will use Web Notifications.
On desktop client, we will use libnotify