webXMPP

Check-in [c393c4bf57]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support for experimental Web OS microservice architecture; notification light.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:c393c4bf57d15bef7a1afb9c5529f32639864c9a701f7170777eacd0b8dc1d30
User & Date: web 2019-03-07 16:18:42
Context
2019-04-12
23:10
Permit FCM key to be left out, and drop support for Firebase. check-in: 9189e1db93 user: web tags: master, trunk
2019-03-07
16:18
Support for experimental Web OS microservice architecture; notification light. check-in: c393c4bf57 user: web tags: master, trunk
2019-02-20
17:51
Initial work, accepting Mastodon pushes (can't get the d*mn server to hand us one, though). check-in: 9a029a23ed user: web tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to html/xmpp.html.

17
18
19
20
21
22
23

24
25
    name = "send" value="Send">
   <button type="button" onclick="return doPoll();">Poll</button>
  </form>

 <script src="/js/ui.js"></script>
 <script src="/js/polling.js"></script>


</body>
</html>







>


17
18
19
20
21
22
23
24
25
26
    name = "send" value="Send">
   <button type="button" onclick="return doPoll();">Poll</button>
  </form>

 <script src="/js/ui.js"></script>
 <script src="/js/polling.js"></script>

 <img style="opacity: 0;" id="fakeimg">
</body>
</html>

Changes to js/polling.js.

1
2
3
4
5
6




7
8
9
10
11





12
13
14
15
16
17
18





19
20
21
22
23
24
25
//
// polling.js
//	Handle page visibility when Long Polling is used
//
"use strict";





// If they let us, post a notification
function notify(s) {
    var n;

    if (Notification.permission == "granted") {






	// Standard Notification
	var opts = {body: s, silent: false};
	n = new Notification("xmpp", opts);
	n.onclick = function() {
	    // Gee, I'd really like to expose my UI
	    // thisWin.focus();






	    // But at least we can start noting new
	    //  messages.
	    moreMessages();

	    // Dispatch this event
	    n.close();






>
>
>
>





>
>
>
>
>







>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// polling.js
//	Handle page visibility when Long Polling is used
//
"use strict";

// Miniserve web services for Firefox OS
const is_FxOS = /Mobile/.test(navigator.userAgent) &&
    /Firefox\/48.0/.test(navigator.userAgent);

// If they let us, post a notification
function notify(s) {
    var n;

    if (Notification.permission == "granted") {

	// Notification light on FxOS back off
	if (is_FxOS) {
	    fakeimg.src = "http://localhost:2020/event/msg?val=1";
	}

	// Standard Notification
	var opts = {body: s, silent: false};
	n = new Notification("xmpp", opts);
	n.onclick = function() {
	    // Gee, I'd really like to expose my UI
	    // thisWin.focus();

	    // Notification light on FxOS back off
	    if (is_FxOS) {
		fakeimg.src = "http://localhost:2020/event/msg?val=0";
	    }

	    // But at least we can start noting new
	    //  messages.
	    moreMessages();

	    // Dispatch this event
	    n.close();