ynput / ayon-backend

Server codebase with API access to AYON
Apache License 2.0
18 stars 14 forks source link

Notifications: When a new inbox item is available send to user over WS #222

Closed Innders closed 1 month ago

Innders commented 1 month ago

Story

I'm on a different website doing stuff and I want to know when a new message comes into AYON.

Problems

Proposal

Fire a WS event when a new inbox item is available. It doesn't need to contain the full message but maybe just a summary and a current unread count.

martastain commented 1 month ago

Would it be okay if the message is "fire and forget"? When a user is online (WS connection is active) and new user reference is created, it would send that message, but if he connect later, the message would be lost?

In that case I could just create a handler that would intercept all new user references and send them. Otherwise, state management would be quite painful.

BigRoy commented 1 month ago

Would it be okay if the message is "fire and forget"? When a user is online (WS connection is active) and new user reference is created, it would send that message, but if he connect later, the message would be lost?

I'd say so, yes. Notifications would be like being active in a chatbox, you'll only get those when in there - you won't get notifications for all the chat history that's happened before you entered. It's kind of like having Discord or Slack open or not. You only get notifications when you have the app open (they do have the ability to mute however).

martastain commented 1 month ago

Mute? Who would mute that cool notification sound I've made? :-)

Okay, that should be doable. And on page load, the frontend would just check for existing unread messages using the API (GraphQL now and eventually using a dedicated REST endpoint)

BigRoy commented 1 month ago

And on page load, the frontend would just check for existing unread messages using the API

Yup, and even then I wouldn't expect that to turn into a notification actually.