On Tuesday, September 10, 2013 10:22:49 AM UTC-7, Vidor Gencel wrote:
> 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!

Have you seen this example webapp which covers push functionality? Not sure if 
it is helpful, but you may try running it and seeing if you run into the same 
problem.
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to