Push Notifications (Push API)

Hello,

I consider redesigning an open source Progressive Web App with simple custom back end to Sollid app. This application uses Push Notification, Notifications API on the client side. And Push API on the server. I would like to ask for your thoughts on how to integrate Push API with a solid server, for example NSS. I thought it might require writing a bot, which would subscribe to Solid WebSockets API and take responsibility for sending notifications using Push API.

It might require a way for applications to store PushSubscriptions on solid server.

Once I start experimenting I’ll share more updates in this thread, at the same time I hope to hear from community if you have already tried to implement Push Notifications.

3 Likes

This thread might be of interest to you.

2 Likes

I agree, something like this will likely be necessary. (I figured to try tackling WebSub (previously PubSubHubbub) first, but this might be a decent approach too.)

2 Likes

This article might be also helpful - https://www.cleveroad.com/blog/how-to-build-a-progressive-web-app-best-tools-and-examples#progressive-web-app-technologies

2 Likes

Just a little question about WebSocket API :
Using this code, I can be notified when a file change but it doesn’t work with the folder. Is there a way to be notified when something happen at the folder level ? Thanks

  var socket = new WebSocket('wss://spoggy.solid.community/');
  console.log ("socket",socket)
  socket.onopen = function() {
    this.send('sub https://spoggy.solid.community/public/test/fichier.ttl');
    this.send('sub https://spoggy.solid.community/public/test/fichier2.ttl');
    this.send('sub https://spoggy.solid.community/public/test/');
  };
  socket.onmessage = function(msg) {
    if (msg.data && msg.data.slice(0, 3) === 'pub') {
      // resource updated, refetch resource
      console.log("msg",msg);
      console.log("data",msg.data)
    }
  };

@Smag0 this feature is not yet supported by node-solid-server. Keep an eye on this issue.

2 Likes

hi @aorumbayev, THxs for your reply.
I thought that there was a file , an “index.ttl” or something like that, that was describing the folder.

for example when I look the source of https://spoggy.solid.community/public/test/, I got the following file. A websocket connected to that could notify the webpage when there are changes … I’m wrong ? But that file doesn’t seems to be accessible ???

@prefix : <#>.
@prefix test: <>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
@prefix terms: <http://purl.org/dc/terms/>.
@prefix XML: <http://www.w3.org/2001/XMLSchema#>.
@prefix ch: <chat/>.
@prefix fol: <folderTest/>.
@prefix lon: <longchat/>.
@prefix web: <websocket/>.
@prefix st: <http://www.w3.org/ns/posix/stat#>.
@prefix tur: <http://www.w3.org/ns/iana/media-types/text/turtle#>.

test:
    a ldp:BasicContainer, ldp:Container;
    terms:modified "2019-05-19T21:43:46Z"^^XML:dateTime;
    ldp:contains
    ch:, <fichier.ttl>, <fichier2.ttl>, fol:, lon:, <sourceFile.ttl>, web:;
    st:mtime 1558302226.761;
    st:size 4096.
ch:
    a ldp:BasicContainer, ldp:Container, ldp:Resource;
    terms:modified "2019-05-08T11:40:34Z"^^XML:dateTime;
    st:mtime 1557315634.173;
    st:size 4096.
<fichier.ttl>
    a tur:Resource, ldp:Resource;
    terms:modified "2019-05-19T22:54:30Z"^^XML:dateTime;
    st:mtime 1558306470.755;
    st:size 3187.
<fichier2.ttl>
    a tur:Resource, ldp:Resource;
    terms:modified "2019-05-19T22:57:54Z"^^XML:dateTime;
    st:mtime 1558306674.43;
    st:size 3184.
fol:
    a ldp:BasicContainer, ldp:Container, ldp:Resource;
    terms:modified "2019-05-08T11:53:52Z"^^XML:dateTime;
    st:mtime 1557316432.179;
    st:size 4096.
lon:
    a ldp:BasicContainer, ldp:Container, ldp:Resource;
    terms:modified "2019-05-08T11:41:57Z"^^XML:dateTime;
    st:mtime 1557315717.604;
    st:size 4096.
<sourceFile.ttl>
    a tur:Resource, ldp:Resource;
    terms:modified "2019-05-08T11:56:59Z"^^XML:dateTime;
    st:mtime 1557316619.798;
    st:size 3266.
web:
    a ldp:BasicContainer, ldp:Container, ldp:Resource;
    terms:modified "2019-05-19T21:44:13Z"^^XML:dateTime;
    st:mtime 1558302253.418;
    st:size 4096.

@Smag0
Im not familiar with the node-solid-server codebase, so I can’t say for sure if that could work. Probably there is a specific reason why right now it only works for files :slight_smile:

But one thing you could try is to check the .acl for this folder, and set write access to public, maybe Websocket cannot establish a connection due to you having limitations to access that folder.