Mahesh
Mahesh

Reputation: 93

How to implement onsite web notification architecture?

I want to send the notification to the website.

I don't have any user information. Our website is not having login and signup option. So that we don't have user data.

but I want to send the notification to the website. how can I implement this type of architecture?

Please explain.

Upvotes: 0

Views: 205

Answers (1)

Miha Jamsek
Miha Jamsek

Reputation: 1273

One possible option is to have your site perform simple interval function, that triggers every x-seconds and requests data (with ajax) from the server.

Then you handle it on client side, whether there is new data or not.

setInterval(function(){ 
    $.ajax(...
         , success : function (res) {
             if(res.data.newData){
                  //push new data to the site
             }
         }
    );
}, 3000);

This is just an example of a function that requests data from server every 3 seconds.

Upvotes: 1

Related Questions