Design push notification


  • 1
    S

    Design push notification :

    • Which sends the notification to the registered users
    • Which receives an event from promotions team
    • Sends notification to iOS, android or sends an email or all three

  • 0
    K

    Is this about how a push notification works?

    The event from promotions team could be received by a REST interface

    Notifications to iOS/android could be simple client-server, where the app on the device pings server and gets new notifications.


  • 0
    S

    @krlinus

    1. yes its should be same as the one you might have been seen in your phone/email.
      2.you are right event would be coming from promotions team and push notification have to recieve it and send the notification to users
    2. App doing ping to the server would not be the efficient way(but I can be wrong), instead it should be initiated from the server. Task of push notification would be to just send the message to the user through app/email, how notification is handled would depend on the device.

  • 1
    E

    is it about pub-sub, which server publish the event to message broker while client get notification by subscriber the event?


  • 1
    V
     Email Server
    	* options
    	   * event or sensors for new mail
    	   * message queued
    Notification server
    	* Polling for new mail
    	* process message queue
    	Notification Manager
    		* invoke/Dispatcher
    	        * Notification service
    	            * push notifications to the devices according through http post
    Mobile/Desktop 
    * if push enabled
    	* service running in the background to listen to notification

  • 0
    J

    (listing only concerned attributes)
    notifications table:

    • type
    • content

    users table

    • subscribed types (sale, new promotion, item type, etc)
    • subscribed media (email, app, text, etc)

    flow:

    1. promotion team creates notification object
    2. look for users who have the matching subscribed types with that notification object's type
    3. send notification according to those users' subscribed media

  • 6
    H

    Its Observer Design Patterns also known as Pub -Sub Model.

    Basically you gotto have a Subject which will accept the list of Observes with the help of register function and as and when any updates happens to the Subject class will trigger a notify call, which internally iterate and called the updates of Observer objects.

    // Basic Skeleton
    class Subject {

       List<Observers>  observers = new ArrayList<Observers>();
       public void  register(Observer obj){
            observers.add(obj);
       }
    
      public void update(){
          foreach(Observer obj : observers){
                       obj.notify();
              }
      }
    

    }

    class Observer{
    public void notify(){
    // do operation
    }
    }

    // Driver

    Observer ob = new Observer();
    Subject sub = new Subject();
    sub.register(ob);
    sub.update(); // call this update when there is something updated on Subject end


  • 0
    S

    @hprem991 Pub-sub design pattern looks perfect for this scenario.

    Thanks for the reply.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.