Let's say that I use React or some other front end framework like Angular or Vue. And let's say that I use Spring Boot for back end. Let's say that users subscribe to something, maybe take as an example particular topic, like discounts of particular category of products. How could I make notification system for that? I haven't started with any code and am interested about "high level thinking" about it.
#Notification system with front end app
1 messages · Page 1 of 1 (latest)
<@&987246841693360200> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
ibe to different types of notifications, such as email notifications, push notifications, or in-app notifications. Here's how you can implement a notification system with a front-end app using React and Spring Boot:
-
Design the database schema: Create a database table to store the user subscriptions and notification details. The table should have columns like user_id, notification_type, subscription_status, etc.
-
Set up the back end: Use Spring Boot to create RESTful APIs for managing user subscriptions and sending notifications. You can use Spring Data JPA to interact with the database.
-
Implement user subscription functionality: Create API endpoints in Spring Boot to allow users to subscribe or unsubscribe from different types of notifications. When a user subscribes, save their preferences in the database.
-
Implement notification sending functionality: Create API endpoints in Spring Boot to send notifications based on user subscriptions. For example, when you want to send an email notification, you can call an API endpoint that triggers an email sending service like SendGrid or SMTP.
-
Build the front end app: Use React (or any other front-end framework) to create the user interface for managing subscriptions and displaying notifications. Use libraries like axios for making API calls to the back end.
-
Displaying notifications: In your front-end app, fetch the list of notifications from the back end using an API call and display them in a list or as pop-ups based on your design requirements.
-
Handling real-time updates: If you want real-time updates for new notifications, you can use technologies like WebSockets or server-sent events (SSE). Implement WebSocket endpoints in Spring Boot and use libraries like socket.io-client in your React app to listen for new notification events.
-
Testing and deployment: Test your application thoroughly by subscribing to different types of notifications and verifying if users receive them correctly. Once tested, deploy your front-end app on a web server (like Nginx) and deploy your Spring Boot back end on a cloud platform (like AWS or Heroku).
Remember to secure your APIs by implementing authentication and authorization mechanisms to ensure that only authorized users can subscribe to notifications and receive them.
Overall, this approach allows you to create a scalable notification system with a front-end app using React and Spring Boot.
you can notify the user using his email. or if you want it to be notified as in the application itself then you can make web socket for that. to subscribe user could for example call an endpoint and then it'll send a websocket in response that have all of the notifications of that category he subscribed to, or instead one socket that handles all type of notifications of each category depending on the connected client's subscriptions.
you could even include the subscribe part within the socket too instead of endpoint if you like.
Can you explain how would that "socketing" work on front end?
instead of websockets, can we use SSE ?
as here we just need to send updates to frontend, no need to 2 way communication for that I believe
yeah, i'd say that is better idea
also @opal thistle what you probably want is implementing observer pattern on your backend side
where observer will send an event to the UI
when pinged by observee
(is that correct word huh )
basically, communication between UI and your data model is detail
conceptually, all the "notification" stuff should happen within backend
if you get what I mean
@rugged otter I have learnt about observer pattern, but I forgot about it. Thanks for reminding about it, at some point I will re-read about it and see how it relates to what I ask about.