# How can I listen for new messages in my Inbox

**URL:** <https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043>\
**Category:** Solid App Development FAQs\
**Created:** [May 13, 2020, 9:12am UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043 "2020-05-13T09:12:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hughgearse](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hughgearse](https://forum.solidproject.org/u/hughgearse)\
**Post date:** [May 13, 2020, 9:12am UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/1 "2020-05-13T09:12:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![alexcorvis84](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/alexcorvis84/32/1276_2.png) [@alexcorvis84](https://forum.solidproject.org/u/alexcorvis84)\
**Post date:** [May 13, 2020, 12:50pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/2 "2020-05-13T12:50:46Z")

</div>

Have you checked the Solid [Websockets spec](https://github.com/solid/solid-spec/blob/master/api-websockets.md)? It might help you (sorry I can’t help you further)

---

<div class="post-metadata">

**Author:** ![aveltens](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/aveltens/32/3987_2.png) [@aveltens](https://forum.solidproject.org/u/aveltens)\
**Post date:** [May 13, 2020, 1:38pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/3 "2020-05-13T13:38:49Z")

</div>

> [@hughgearse](#):
>
> “sub [https://user1.solid.community/inbox”](https://user1.solid.community/inbox%E2%80%9D)

can you try the following?

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

```

(spot the trailing slash I added)

---

<div class="post-metadata">

**Author:** ![hughgearse](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hughgearse](https://forum.solidproject.org/u/hughgearse)\
**Post date:** [May 13, 2020, 3:39pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/5 "2020-05-13T15:39:31Z")

</div>

I am getting a lot of erratic behaviour when it comes to the WebSockets API. I put the most basic example on [jsFiddle](https://jsfiddle.net/wfvotrhm/) 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](https://otto-aa.github.io/solid-filemanager/) and then delete these files then I DO receive the pub messages.

I have also done some testing on [websocket.org](http://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.

---

<div class="post-metadata">

**Author:** ![aveltens](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/aveltens/32/3987_2.png) [@aveltens](https://forum.solidproject.org/u/aveltens)\
**Post date:** [May 13, 2020, 3:56pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/6 "2020-05-13T15:56:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hughgearse](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hughgearse](https://forum.solidproject.org/u/hughgearse)\
**Post date:** [May 13, 2020, 3:57pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/7 "2020-05-13T15:57:22Z")

</div>

Is there somewhere I should report this as an issue?

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [May 13, 2020, 10:15pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/8 "2020-05-13T22:15:27Z")

</div>

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

> <https://github.com/scenaristeur/agora/blob/a638cea5708c62310ed395acd6920730185f66ca/src/views/inbox-view.js#L249>

---

<div class="post-metadata">

**Author:** ![A\_A](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/a_a/32/786_2.png) [@A\_A](https://forum.solidproject.org/u/A_A)\
**Post date:** [May 14, 2020, 7:29am UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/9 "2020-05-14T07:29:26Z")

</div>

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](https://github.com/solid/node-solid-server/issues/933)

> 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.

---

<div class="post-metadata">

**Author:** ![hughgearse](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hughgearse](https://forum.solidproject.org/u/hughgearse)\
**Post date:** [May 14, 2020, 11:48am UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/10 "2020-05-14T11:48:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![hughgearse](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@hughgearse](https://forum.solidproject.org/u/hughgearse)\
**Post date:** [May 14, 2020, 2:05pm UTC](https://forum.solidproject.org/t/how-can-i-listen-for-new-messages-in-my-inbox/3043/11 "2020-05-14T14:05:27Z")

</div>

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