I have spent some time reworking the notifications by implementing server sent events (SSE). The addon is still in a raw state but mostly working. Basically it fetches the state of notifications from the DB on page load (like we do now via mod ping). New notifications will be sent from the server to the client via SSE - no more need to ping the server every x seconds.
Modern browsers (with support for shared workers) will only keep one connection to the server open no matter how many tabs/windows are open. I am not sure how big the actual impact on performance this change would bring but i guess it will be slightly lighter on the server since the addon does not ping the server every x seconds anymore and also there are no more DB queries for followup notifications (they are generated when receiving items).
To try the SSE addon you need to checkout the sse branch for core and addons, then enable the SSE addon in the admin panel.
I have only tested this with nginx so far and it works quite well. I would appreciate it if somebody could test this with apache and report back issues. Also it would be good to get some data about performance changes compared to the traditional notification system (mod ping).
!!
zotlabs.org | Hubzilla Development