How can I listen for new messages in my Inbox

I want to listen for new messages in my inbox. I have tried doing the following (for a hypothetical “user1”):

Open a web socket at “wss://user1.solid.community”
Send the following string: “sub https://user1.solid.community/inbox”
Listen for incoming messages

But when something is sent to my Inbox I do not receive anything on the socket. And I have confirmed that the new documents are being placed in the inbox folder.

Am I missing something here?

Have you checked the Solid Websockets spec? It might help you (sorry I can’t help you further)

can you try the following?

sub https://user1.solid.community/inbox/

(spot the trailing slash I added)

I am getting a lot of erratic behaviour when it comes to the WebSockets API. I put the most basic example on jsFiddle to monitor the inbox for my own Solid account. When I post a new message to my Inbox then I do NOT receive any updates. However if I go to the Solid Filemanager and then delete these files then I DO receive the pub messages.

I have also done some testing on websocket.org and that has also behaved in a very erratic way. Sometimes it works sometimes it doesn’t.

So the only conclusion I can draw at this stage is that the WebSockets API cannot be relied upon - at least when it comes to monitoring a container - I haven’t done any testing yet on monitoring a document.

hmm wierd, sorry cannot tell, did not use the websocket API so far besides tiny experiment. Might be a Bug in NSS, perhaps you can find an open issue there, or file one otherwise.

Is there somewhere I should report this as an issue?

Yes I can, 'i’ve tested but sadly the websocket don’t work on folder, only on files, so what I do is a simple log.ttl where I put a new triple in the same time that when I post to inbox & I subscribe to change in that log.ttl file. Not optimal but that folks

1 Like

There’s already an issue at the node-solid-server about this: Watch changes in folder via WebSockets · Issue #933 · nodeSolidServer/node-solid-server · GitHub

When using websockets on a folder, I don’t get pub messages when a file is added to that folder. However, it would nice to have such a feature. For example, to detect if new notifications arrive in the inbox of a user.

2 Likes

But you would have to write to the “log.ttl” document on the other user’s POD for this to work? If so, is there a way of doing that?

Scratch that question. I have just discovered the WAC spec!