0

I wonder how social media websites pop up a notification for every action that happens on your timeline.

Am in need real-time notification system keeps track of every action you and your friends do on these social channels. Notifications form a big part of the real-time engagement feature of these platforms. Even you are not online, you could still receive these notifications.

1

1 Answer 1

1

There are a few ways to achieve this.

  • Long polling Make an HTTP request to the backend, the backend will then hold this request until there is a message that has to be sent to the client. (this is an older way but is still in use)
  • Push API Quite new, has pretty decent support. Find more info here: https://developer.mozilla.org/en-US/docs/Web/API/Push_API
  • Websockets Set up 2 way communication with the server. PHP is really bad at this imo and it's overkill if you're just trying to send notifications.

Both Long polling & Push API are a good solution these days depending on which browsers you need to support.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.