Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6793097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:03:36+00:00 2026-05-26T18:03:36+00:00

The closest example to my case is a Django ajax chat application. The rooms

  • 0

The closest example to my case is a Django ajax chat application. The rooms need to keep a list of active users. Aside from displaying that list of users within the chat, a given room might have a maximum number of active users; new users need to be blocked from entering if there’s no room.

Currently I have the chat client page calling a poll view every second via ajax. The poll view returns the text of the room. I figure poll can just also do some type of pinging — adding users to an active_user M2M field on the Room object (I have all of this in place so far). What I need next is something that drops users from that active_user list after some kind of timeout.

I imagine there’s two ways to do this, and I’m wondering which would be more efficient for an app that needs to be accurate to the second (or ten/fifteen seconds):

  • Using cookies / sessions / middleware a la this thread (however it seems to me that this method wouldn’t work for moment-to-moment info
  • Another model, such as an explicit Users_Rooms ‘through’ table with a datetime field for the time that is updated upon creation and with every ping following, and write some function that cleans up the old ones

That’s all I can think of. I’m just trying to figure out whether hitting mySQL every second for every user for every room is a good idea, and wondering if that second is indeed the best option for the task. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:03:37+00:00Added an answer on May 26, 2026 at 6:03 pm

    I’d use sessions and store last ping datetime as a session parameter. Don’t worry about database hits, if at the certain point you would feel that you’re getting too many of them, just switch your session storage to cache.

    Make your application robust to cache-flushing.

    One of my friends used to host a relatively popular django-based social networking game on a pretty much standard virtual private server, and it took a while before he was forced to switch to cache-based sessions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had an application for returning closest matches to certain values in a large
I'm trying to sort a list of CLLocationDistance values by closest distance (ascending order).
I'm loading an xml document using JavaScript (Jquery $.ajax ). I need to be
I copied this example from api.jquery.com $('.target').change(function() { alert('Handler for .change() called.'); }); I
The closest I've seen in the PHP docs, is to fread() a given length,
What is the closest you can get to a try-catch block in php4? I'm
I have the following jQuery: $(this).closest('div.mcoup').find('div.delcoup').slideToggle(400) .siblings().children('div.delcoup').slideUp(400); What I'm trying to do is get
I want to show the closest related item for a product. So say I
I'm using a Segment to Segment closest approach method which will output the closest
What is the most efficient way to cacluate the closest power of a 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.