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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:22:45+00:00 2026-05-29T16:22:45+00:00

Recently, I am going to make a instant-notification system for my website. I heard

  • 0

Recently, I am going to make a instant-notification system for my website. I heard COMET is an essential in such cases.

I have been searching about PHP & Comet for a while already, however, the guides & articles I have found seems like just ajax requests in a loop. For example, there is a basic javascript code which gets the value from PHP file every 2 seconds and outputs to HTML. As far as I know, it should be COMET pushing new values to HTML, hence, the loop should be on server side, not client. Half of the articles in my native language was using setInterval() and contact PHP file every X seconds.

So, I have some questions to ask you.

  1. Is there any guides or examples, which doesn’t use any external framework like XAJAX/NOLOH that is easy to understand?
  2. What is the performance difference between using COMET in server side, or requesting value from ajax.php every X seconds?
  3. The timed requests I mentioned above can be called as COMET? (ex. Long Polling using jQuery and PHP)
  4. Do I need any extensions to run COMET serverside? (My webhost is using Apache, I personally use Nginx)
  • 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-29T16:22:47+00:00Added an answer on May 29, 2026 at 4:22 pm

    You have to use a client-side script (AJAX), because the server has to be polled. The server cannot simply send messages to someone’s browser without an open connection.
    I’m not too familiar with HTML5 websockets, but I believe this allows you can have a persistent connection with the server, however HTML5 browsers aren’t used widely to use this as a solution on a ‘public’ website.

    How long polling works is that an asynchronous request is sent from the browser with a long time-out time (e.g. 30 seconds), when the request arrives at the server, it goes and checks for new messages, but when there are now messages to be displayed, instead of directly outputting the result, it goes into an infinite loop, polling the database e.g. every second (using sleep to postpone the queries), until a message has been found. When a message has been found it terminates the loop and outputs the result. If there have been no messages after 30 seconds, the script times out and sends back an empty request.

    So the request can be sent back between 0 and 30 seconds. As soon as the request arrives in the browser, it is handled and a new 30 second request is sent.

    As for your questions;

    1. You will need a client-side framework for doing the polling
    2. You cannot use Comet only on server-side. Using longpolling over normal polling (e.g. polling every second) is significant because you make much less server requests
    3. To my understanding; yes
    4. You can use any server-side language, as long as it can keep the connection open while querying for messages.

    Also take a look at http://nodejs.org/

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

Sidebar

Related Questions

Recently, I have been going through search trees and I encountered red-black trees, the
I've switched over to a Mac recently and, although things have been going quite
I have been recently going through my database code trying to improve on my
I have recently started a fairly large web project which is going to use
I have recently started to learn about programming for the iPhone and after going
I have been recently drilled in a couple of interviews about Hashtables and when
I'm having some issues with a Wordpress website I recently built. I have implemented
Recently we are going to develop some products on mobile phone (specially for 3g).
Recently I was going through a blog and noticed some points about using PDO
Recently i saw an open source javascript library have a line like : style

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.