You are definitely on the right track, but I suggest putting notification materials in your application, rather than querying your database. For example, a friendโs request, do this when a friendโs request is sent:
function send_friend_request($from, $to) { $mysqli->whatever you do with that; send_notification($to, 'You have a friend request!'); }
where send_notification is a method that sends a POST request to your nodejs server. The nodejs server receives a POST and passes a message to what is listening to $to .
source share