Hi, I am doing a webpage in JSP and Spring Boot. I want to add to it some notification capabilites, I want it to behave like a mail page in the sense that no matter if I'm in the inbox or reading a message, if I receive a new one then the inbox menu option becames bold to notify me.
When searching for info I found two things:
1.- I could use session attributes and force page refresh with Ajax, achieving that no matter what part of my page you are, you will receive the notification, but I want a more real-time thing.
2.- Using websockets, I could do this real time, but then the client have to be in some URL waiting for the notifications, like in a chat.
I want to know if there is some way of achieving this (i.e. receiving notifications real time, no matter what part of my page you are) or if I misunderstood how websockets work.
You would want to have some kind of ajax as backup in case their browser doesn't support web sockets or whatever. If your site changes pages using JSP then you could just have them reconnect every time they change the page. Maybe I'm wrong though
posted 4 months ago
Thanks for the suggestion. I will look into it and if it's too much overload for this. Constantly closing and opening new connections might slow things too much.