This week's book giveaway is in the Open Source forum.
We're giving away four copies of Programmers Guide to Apache Thrift and have Randy Abernethy on-line!
See this thread for details.
Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Real time notifications  RSS feed

 
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.
 
Rancher
Posts: 427
6
Fedora IntelliJ IDE Spring
  • 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: 5475
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!