• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Real time notifications

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks in advance,
Frege.
 
Master Rancher
Posts: 451
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
frege fregenal
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 5579
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of web sockets you might look into server sent events, assuming your target browsers support those. But it's not a new standard, so the chances are probably good.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!