I have problems with simple push on ffos. Here is my code:

    var endpoint;
    $(document).ready(function() {
        registerPush();
        navigator.mozSetMessageHandler("push", function(message) {
            if(message.pushEndpoint == endpoint) {
                console.log("push notification: "+message.version);
            }
        });
        navigator.mozSetMessageHandler("push-register", function() {
            registerPush();
        });
    });
    function registerPush() {
        var req = navigator.push.register();
        req.onsuccess = function(e) {
            endpoint = e.target.result;
            console.log(endpoint);
        }
    }

It is working ok when i start the app, but after few minutes if i try to send a 
push to the endpoint, nothing happens. But when i call the registerPush(); 
function, everithing works again for few minutes.


Any help would be greatly appreciated!
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to