Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Showing Current User Count on HTML Page  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been showing the current user count on my html page by each time a user accesses application a remote record counter is incremented by one.

Then I have a AJAX request set to a timer to keep the current user count semi accurate.

I would like to get away from these remote calls to my data base.

I have implemented an HttpSessionListener to count the ActiveSessions.

However, I need a way to update the html page with the count.

I have added this code into my filter class but I don't think this is the most correct way to handle this:

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The filter isn't going to run without a page refresh the way you are doing it.

If it's a hard requirement that Ajax polling isn't going to cut it, you'll need to look into newer "always connected" technologies. Bear in mind, these are expensive technologies and something like keeping a user count up-to-date doesn't seem like a really good use of them.

Why isn't the background polling good enough? Is there a re reason that the info needs to always be real time?
 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Is there a re reason that the info needs to always be real time?


Thanks.

I am thinking you are right, may be overkill to show real time current user count. I have a function already in place that will show a list of current users when user clicks an icon. I think this should be enough.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!