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

  • SEARCH
  • Home
  • 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 7685471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:15:32+00:00 2026-05-31T19:15:32+00:00

So I have a Rails app (which in this case seems like it would

  • 0

So I have a Rails app (which in this case seems like it would be irrelevant, but I’ll mention it anyway). It’s a sort of chat room application.

In order to tell which users are currently in a chat room, I’ve been using Javascript polling.

So a simple

$(function() {
    setTimeout(updateUsers, 15000);
});

where updateUsers just calls an AJAX get request to pull the array of users currently in the chatroom.

Here’s my question: 15 seconds is a pretty long time to wait to poll. How frequently should I do it without performance issues? Obviously it depends on a lot of factors, but I’d like to hear those factors. I’ve seen a bunch of similar questions for receiving messages in chat rooms, but none yet for lists of users, which is why I’m asking this question.

  • 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-31T19:15:33+00:00Added an answer on May 31, 2026 at 7:15 pm

    It depends on a ton of things, like your infrastructure, the number of expected users, etc. Even if we had those numbers, it’s hard to tell what would be a good timeout.

    If you are only sending out a simple JSON array with the list of users, I’d say experiment with a 3-5 seconds delay and check from there. This is a problem of premature optimization- you’re trying to solve a problem you don’t yet have.

    There are, however, two other possible solutions:

    You could only send the difference. When you poll, you return a message saying which users have connected and which have left since the last polling. This requires some kind of server tracking, but can be done.

    The other solution would be to not use polling at all, and use a more modern technology like WebSockets / Long-polling. Those will allow the server itself to send messages to your clients. As such, you can send them an initial list when they connect, and a single minimal message everytime someone else connects / leaves. A great solution to this in a Node environment is Socket.IO. I’m not much of a Ruby guy so I don’t know if anyone has done something similar but I wouldn’t be surprised if someone had ported the whole thing to Rails. Search around, I’m sure you’ll find something that fits your needs.

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

Sidebar

Related Questions

I have a sequence of migrations in a rails app which includes the following
I have a JavaScript widget which communicates with my Rails app by creating tags
In my Rails app, I have a form which redirects through a foreign service,
I have a rails app that has picked up a bit of traction, but
I have a rails app that uses heavily js (over 1MB total). I'd like
I have rails app which has a list of users. I have different relations
I have a rails app which requires users to verify that they own a
i have a rails app which makes heavy use of activeresource and httparty to
Is it feasible to have a Ruby on Rails app, which is: a) deployed
I'm building an app in Rails 3. I currently have a user model which

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.