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 8550235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:54:19+00:00 2026-06-11T13:54:19+00:00

Okay so I was trying to build something similar to a real time application

  • 0

Okay so I was trying to build something similar to a real time application (something that gets new data from a database as soon as it is added) and the only solution I could come up with was constantly using ajax requests (via the setInterval() method in javascript) to check for new information every couple of seconds, but I was curious about what sort of strain this would put on a database or a server.

Would doing such a thing be overkill or is there a better method for building a real time application?

  • 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-06-11T13:54:21+00:00Added an answer on June 11, 2026 at 1:54 pm

    Your problem boils down to two options, long polling or short polling. In the first option, an AJAX request is sent to the server. the server searches for new updates. If found, it returns that immediately. Else it sleeps, say for 0.5 seconds, after which it again searches for updates. This goes on for some prescribed time, after which whatever is there in the data array is sent. On receiving the response, the JS can take appropriate response (if there is some data, perhaps use that to manipulate the DOM), and send another request, and this continues ad infinitum. This has a drawback, that it consumes substantial resources on the server side. But if you want the new updates to reflect almost immediately (like in Facebook), this may be your best bet.

    In the second option, as you mentioned, the load on the server side is reduced alright. But the time taken to reflect the update may be more. Plus, if the user’s internet speed is slow, it will add to the delay. Not to mention, that repeated requests my waste user bandwidth (although that can be alleviated if you design your site to ensure only minimal data is sent). The Websockets API may be convenient, but to the best of my knowledge, it is not fully supported in all browsers,except their latest versions.

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

Sidebar

Related Questions

Okay I have been racking my brain trying to build a JSON array from
Okay so I'm trying to make a little gag program that will run away
Okay here is what I'm trying to do: I have a model object that
Okay so i have done a tutorial that has me populating a TableViewController from
I am trying to build a program that uses libusb and I get a
I have been trying to build Pocketsphinx for my android application and I have
Okay, I'm thoroughly stumped on this one. I'm trying to build a menu of
I'm trying to debug my application and from the point I fire it up
Okay so what I'm trying to do is get the filename from OpenFileDialog/SaveFileDialog, only
I'm trying to build up some functions to variably build up queries from arrays.

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.