Last active
December 16, 2015 17:18
-
-
Save digitarald/5468932 to your computer and use it in GitHub Desktop.
Push2B2G
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Issue a register() call | |
| * To register to listen for a notification, you simply call push.register | |
| */ | |
| var pushReq = navigator.push.register(); | |
| pushReq.onsuccess = function(e) { | |
| alert('pushReq.onsuccess'); | |
| var endpoint = pushReq.result; | |
| // Store it | |
| localStorage.setItem('endpoint', endpoint); | |
| // Tell the server | |
| App._postBack('/', { | |
| endpoint: endpoint | |
| }, function(err, response) { | |
| if (err) { | |
| next(err); | |
| return; | |
| } | |
| next(); | |
| }); | |
| }; | |
| pushReq.onerror = function() { | |
| alert('pushReq.onerror ' + pushReq.message); | |
| next(new Error('push.register error')); | |
| }; | |
| // alert('pushReq ' + pushReq.readyState); | |
| // Always pending ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I/IdleService( 109): next timeout 1000 msec from now | |
| I/IdleService( 109): SetTimerExpiryIfBefore: next timeout 1000 msec from now | |
| I/IdleService( 109): reset timer expiry to 1009 msec from now | |
| I/IdleService( 109): Reset idle timeout: tell observer 48949c50 user is back | |
| I/Gonk ( 109): Changed nice for pid 530 from 18 to 1. | |
| D/memalloc( 109): /dev/pmem: Allocated buffer base:0x4ab3c000 size:614400 offset:2293760 fd:114 | |
| I/Gonk ( 109): Changed nice for pid 553 from 0 to 18. | |
| D/memalloc( 109): /dev/pmem: Allocated buffer base:0x4ab3c000 size:614400 offset:2908160 fd:132 | |
| D/memalloc( 109): /dev/pmem: Allocated buffer base:0x4ab3c000 size:614400 offset:5529600 fd:161 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4ad6c000 size:614400 offset:2293760 fd:114 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4ae02000 size:614400 offset:2908160 fd:132 | |
| D/memalloc( 109): /dev/pmem: Allocated buffer base:0x4ab3c000 size:614400 offset:2293760 fd:116 | |
| E/GeckoConsole( 530): Content JS LOG at app://0095964c-1b8b-3743-a41b-3e18020eec33/index.js:101 in anonymous: pushReq pending | |
| I/Gonk ( 109): Changed nice for pid 379 from 1 to 18. | |
| D/memalloc( 109): /dev/pmem: Allocated buffer base:0x4ab3c000 size:86016 offset:1556480 fd:114 | |
| D/memalloc( 530): /dev/pmem: Mapped buffer base:0x442a1000 size:1642496 offset:1556480 fd:33 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x426ae000 size:614400 offset:0 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4ae98000 size:614400 offset:3522560 fd:85 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4af2e000 size:8192 offset:4136960 fd:97 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4af30000 size:614400 offset:4145152 fd:104 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4afc6000 size:12288 offset:4759552 fd:122 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4ac7c000 size:122880 offset:1310720 fd:149 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4ab3c000 size:614400 offset:0 fd:133 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x462ca000 size:4861952 offset:4853760 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4afdd000 size:8192 offset:4853760 fd:136 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x448f2000 size:1228800 offset:614400 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4abd2000 size:614400 offset:614400 fd:139 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x4676d000 size:4874240 offset:4861952 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4afdf000 size:12288 offset:4861952 fd:142 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x44a1e000 size:1556480 offset:1433600 | |
| D/memalloc( 109): /dev/pmem: Freeing buffer base:0x4ac9a000 size:122880 offset:1433600 fd:125 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x44500000 size:4136960 offset:3522560 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x45000000 size:4145152 offset:4136960 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x45481000 size:4759552 offset:4145152 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x4596a000 size:4771840 offset:4759552 | |
| D/memalloc( 379): /dev/pmem: Unmapping buffer base:0x46c13000 size:1433600 offset:1310720 | |
| I/IdleService( 109): Get idle time: time since reset 951 msec | |
| I/IdleService( 109): Idle timer callback: current idle time 951 msec | |
| I/IdleService( 109): next timeout 48 msec from now | |
| I/IdleService( 109): SetTimerExpiryIfBefore: next timeout 48 msec from now | |
| I/IdleService( 109): reset timer expiry to 58 msec from now | |
| I/IdleService( 109): Get idle time: time since reset 1008 msec | |
| I/IdleService( 109): Idle timer callback: current idle time 1008 msec | |
| I/IdleService( 109): next timeout 4294967293991 msec from now | |
| I/IdleService( 109): SetTimerExpiryIfBefore: next timeout 4294967293991 msec from now | |
| I/IdleService( 109): reset timer expiry to 4294967294001 msec from now | |
| I/IdleService( 109): Idle timer callback: tell observer 48949c50 user is idle | |
| I/IdleService( 109): Get idle time: time since reset 1008 msec | |
| E/profiler( 553): Registering start signal | |
| E/GeckoConsole( 553): [JavaScript Warning: "Unknown property '-moz-align-self'. Declaration dropped." {file: "resource://gre-resources/ua.css" line: 44}] | |
| I/Gecko ( 553): ###################################### forms.js loaded | |
| I/Gecko ( 553): ############################### browserElementPanning.js loaded | |
| I/Gecko ( 553): ######################## BrowserElementChildPreload.js loaded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "P2G", | |
| "version": "0.1", | |
| "developer": { | |
| "name": "Harald Kirschner", | |
| "url": "http://digitarald.com/" | |
| }, | |
| "launch_path": "/index.html", | |
| "icons": { | |
| "128": "/icon.png" | |
| }, | |
| "type": "privileged", | |
| "permissions": { | |
| "push": { | |
| "description": "To keep you in the loop!" | |
| } | |
| }, | |
| "messages": [ | |
| { | |
| "push": "/index.html" | |
| }, | |
| { | |
| "push-register": "/index.html" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in /data/b2g/mozilla/[profile-id]/user.js | |
| user_pref("services.push.enabled", true); | |
| user_pref("services.push.serverURL", "wss://www.simple-push.com:9999"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment