Setting up notifications in a serverless infrastructure.

My backend is using MongoDB & serverless. Frontend is using tanstack query. What I am doing currently - 1. Listening to a websocket (at wss://websockets.company.com/and if there is a notification, I do the following - 1.a. Invalidate my notifications query 1.b. Look at the event that was just heard at the websocket and parse it for the alert I want to give (eg - if the event looked like {type: "task", action "completed", _id: "123"} I would give an alert that a task was completed in a snackbar and invalidate that task query) Questions - 1. How should I be setting up hearing for notifications? Is 1.a fine? 2. What should the format for the notification be? Is there a standard? Since there will be many notifications over time, I'd love some advice on what is the best way to set this up. Currently mine just looks like a massive switch case / if-else block.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server