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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:39:26+00:00 2026-05-19T05:39:26+00:00

I have a AJAX client which must receive messages from server. Some messages from

  • 0

I have a AJAX client which must receive messages from server. Some messages from server not like request-response type. For example, imaging game in which players can enter. Server must send to client info about player entering. But how can server send message to client via http without request from client?
Only decision that i can invent: client send request to server (getNewPlayerEnter request) with big timeout, server checks state of player set, if in set new players are, then server send info to client, if not server ‘sleeps’ on some time, and after ‘sleeping’ server checks players set again.
I think my desicion a little stupid(maybe not little). How implement it right?
p.s. sorry for my english

  • 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-19T05:39:28+00:00Added an answer on May 19, 2026 at 5:39 am

    What you are referring to is “polling” where your client side code will make a request to the server every X seconds to check for updates.

    It’s an easy to implement solution, which is why you see it so often. However, a better solution is to use Comet.

    In 2006, Alex Russell coined the term “Comet” to identify a technique whereby the client makes and HTTP request to the server and the server keeps that connection open indefinitely. With this open connection, the server can then push updates to the client in the response when there are updates.

    When the response is received, the client immediately opens a new long-lived HTTP connection.

    I encourage you to do a search for “Comet” and whatever server-side language you are using to find a framework that will get you started.

    Comet Daily has some really great demos, from chat applications to games, that use Comet. If you have a tool like Firebug or Chrome Debugger, you can observe the response/request cycle of these real-time applications.

    http://cometdaily.com/2009/10/23/concrete-comet-examples/

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

Sidebar

Related Questions

I have an ajax call, which returns datetime. Javascript displays it using client timezone.
I have this jquery.ajax form which populates data from the database and auto fills
I have set up an AJAX contact form on a client's website. The problem
Using the client-side ASP.NET AJAX library, I have created an instance of a client
I would like to have Ajax form in Rails so i'm using form_remote_tag. The
I have some AJAX work that brings across an additional form element that I
I plan to write web app which will work mostly on client side (AJAX)
I have an ajax call in jquery which returns 4 different arrays. 3 of
I have a checkbox and a textbox client which works good when they are
I have an XML document which contains some invalid characters (é for example). Unfortunalty

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.