🔔 Hack Forums Notify System Rebuilt
A major rebuild of the HF notification system is now live.
The old notification system had been around for a long time and had accumulated a lot of legacy behavior, old frontend code, and outdated assumptions about how browsers handle realtime notifications.
Over the past several days I rebuilt a large portion of the system so that notifications are faster, cleaner, more reliable, and easier to expand in the future.
This ended up being a much bigger project than it first appeared. 😅
⚙️ What Changed
The new system now has multiple layers working together:
• Realtime onsite notifications
• Browser push notifications
• Native Windows / mobile notifications
• Improved notification popup
• Individual read tracking
• Unread notifications sorted first
• Notification preferences
• Better support for future notification types
• More reliable background processing
The visible part may look relatively simple, but there is quite a bit happening behind the scenes.
⚡ Realtime Onsite Notifications
When you're logged into HF and have the site open, new notifications can now appear in realtime without constantly refreshing the page.
There is no aggressive browser polling involved.
Instead, HF receives a lightweight realtime signal when something changes, and the browser then retrieves the authoritative notification data from the site.
This keeps the system responsive without having every browser repeatedly hammer the server asking:
"Any notifications yet?"
every few seconds. 😄
🖥️ Browser Push Notifications
One of the biggest additions is proper browser push support.
If enabled in your notification settings, HF can now send native browser/OS notifications even when you're not actively looking at the site.
For example:
🔔 New Private Message
💬 Someone quoted your post
🏷️ Someone mentioned you
🧵 Someone replied to your thread
On Windows these appear through the normal Windows notification system.
On supported mobile browsers they can also appear as regular device notifications.
Each device/browser has its own subscription, so you can independently enable push notifications on your desktop, laptop, phone, etc.
📬 Current Notification Types
The current system supports:
• Private Messages
• Mentions
• Quoted replies
• Replies to your threads
The system was also rebuilt so that new notification types can be added by other HF plugins without having to rewrite the notification system itself.
That was an important part of the redesign.
For example, future plugins could potentially add notifications for things such as:
• Awards
• Marketplace activity
• Account events
• Custom plugin alerts
• Other HF features
Those can plug into the same notification framework.
🎛️ New Notification Settings
The old standalone notification preference page has effectively been replaced by a much cleaner settings popup directly inside the notification panel.
You can configure which types of notifications you want and whether browser push is enabled.
The notification popup itself also received several UI improvements:
✓ Mark notifications read
⚙ Notification settings
✕ Close
Unread notifications are now automatically displayed before read notifications, which makes the list much easier to scan.
📖 Read / Unread Behavior
Clicking a notification now marks that specific notification as read.
When the notification list reloads, unread items remain at the top while read items move below them.
The unread badge also stays synchronized with the actual notification state.
This sounds simple, but getting the browser navigation, read state, realtime updates, and popup state all behaving consistently required quite a bit of work.
🔧 Reliability Improvements
A lot of this rebuild wasn't visible frontend work.
There was also substantial backend work involving:
• Notification event storage
• Delivery queues
• Browser subscriptions
• Background workers
• Realtime socket handling
• Service workers
• Retry handling
• Expired subscription cleanup
• Process monitoring
• Automatic startup after server reboots
• Browser and OS notification behavior
One especially annoying issue involved a long-running background process using a timestamp value that was perfectly fine during normal web requests but became stale when the process stayed alive for hours.
That caused queued push notifications to sit until the worker restarted.
That took some digging to identify, but it's now fixed. 😄
🌐 Browser / OS Integration
One thing worth mentioning is that browser push notifications are ultimately controlled by both your browser and operating system.
For example, on Windows:
HF permission
→ Browser permission
→ Windows notification permission
all need to allow notifications.
So if you enable Browser Push on HF but never see a notification, make sure notifications are also enabled for your browser in Windows.
📱 Multiple Devices
Push subscriptions are device-specific.
Enabling browser push on your desktop does not automatically enable it on your phone.
If you want HF notifications on multiple devices, enable Browser Push from HF on each browser/device you want to receive them on.
🧪 Testing & Development
This rebuild involved a lot of testing across:
• PHP
• JavaScript
• WebSockets
• Service Workers
• Browser Push APIs
• Database queues
• Firefox
• Windows notifications
• Background PHP workers
• Process management
• Cloudflare
• Nginx
There were plenty of little issues along the way.
Some examples:
• notifications being queued but not delivered
• browser subscriptions becoming stale
• service worker conflicts
• popup controls being tied to legacy code
• read-state timing during navigation
• realtime socket reconnect behavior
• background workers not staying active
• caching making JavaScript changes appear broken
• OS notifications being disabled even when Firefox permissions were enabled
In total, I've probably spent around 10 hours specifically on the new onsite + browser push notification system so far.
That does not include the separate Telegram notification system.
🚀 Why Rebuild It?
The goal wasn't just to make the current notifications work better.
The bigger goal was to create a notification framework HF can build on going forward.
Instead of every plugin inventing its own notification method, future HF features can use a common system for:
• storing notifications
• displaying them
• tracking read state
• realtime alerts
• browser push
• user preferences
That should make future development much cleaner.
🐛 Report Problems
If you notice anything strange with notifications, please post about it.
Useful reports would include things like:
• notifications not appearing
• duplicate notifications
• incorrect unread counts
• browser push not arriving
• wrong notification links
• notices not being marked read
• mobile-specific problems
Please include your browser/device if the problem involves browser push.
🔔 HF Notify is now considerably more modern than it was a few days ago.
There are still a few small cleanup items left, but the major rebuild is working.
There are still a few small cleanup items left, but the major rebuild is working.



![[Image: jcole1.gif]](https://i.ibb.co/LdxBL1y/jcole1.gif)



![[Image: zMpMcDB.png]](https://i.imgur.com/zMpMcDB.png)

![[Image: 3.gif]](https://i.ibb.co/zH0GQ122/3.gif)
