I need help with push notifications implementation

ighoterry2ighoterry2 Posts: 14
edited January 2019 in Chats
I need help with push notifications implementation

Comments

  • dhtmldhtml Posts: 984
    edited January 2019

    you need to explain a bit clearly what you really want

  • ighoterry2ighoterry2 Posts: 14
    edited January 2019
    What I'm taking about is something like how facebook sends individual notifications depending on actions to different users
  • dogstyle007dogstyle007 Posts: 51
    edited January 2019
    Do you mean app notification?
  • ighoterry2ighoterry2 Posts: 14
    edited January 2019
  • limistahlimistah Posts: 318
    edited January 2019
    What you intend doing is bit tricky but let's take it a step at a time.

    You like a photo

    An entry is made into the notification db with details specifying your action(type of notification, who owns the photo, who liked the photo, when, has it been read).

    On page loads(apps web or mobile) loads all notifications with pagination.

    Unread notification is highlighted.

    When notification icon is clicked, all unread notifications are updated in the db as read.

    You can also monitor if a particular notification has been clicked this requires some extra logic, an entry in the db for each notification stating either clicked or not. This way, it is easy to distinguish which notification has actually been clicked on either read or not. This should b how you see some highlight in the notification panel that are not new.



    I hope this helps
  • ighoterry2ighoterry2 Posts: 14
    edited January 2019
    I understand these points

    What I want is for these notifications to be pushed,



    Like when the user is not on the website or app if a picture he or she has is liked a push notification is sent to him or her
  • limistahlimistah Posts: 318
    edited January 2019
    Like someone stated in another post seniors create confusion with their grammars.



    To push you either need socket implementation or a real time long polling of the server.



    When you app notices internet connection, it calls the notification endpoint at intervals seeking if there are new updates, if they are, add a new notification with the details of the latest pulled ones. Of they are not ignore. That is long polling somehow, look into network tab of Facebook and see there are some calls that are made after a variant of the call has resolved. This keeps it real time.



    With socket, clients connect to the server on a port, when a user likes a photo, you publish a new event to the connected clients, the clients receives and acts on the newly received data.



    Simply, use socket or long polling. And make sure your app calls the notification endpoint when internet is noticed to show new ones in the drawer.
  • dhtmldhtml Posts: 984

    This question of poll vs socket is always an interesting one.

Sign In or Register to comment.