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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:17:27+00:00 2026-05-28T05:17:27+00:00

I am going to bed soon, so I will not be on until the

  • 0

I am going to bed soon, so I will not be on until the morning, but I have been struggling with trying to find a javascript/jquery method that solves my problem. I am trying to make a chat box feature where once a post is submitting it is then echoed back out and users on both ends can see it. I know that I need to use javascript and or jquery. Right now I am using a very inefficiency system:

<script language='javascript' type='text/javascript'>
    setInterval( function() {
    $('#responsechat').load('echogetconversation.php?username=<?php echo   $username; ?>&otherchatuser=<?php echo $otherchatuser; ?>');
    }, 100);
    </script>

The only reason that I am using it is because it is the only way I know how to project new posts to both users. I was wondering if someone knew a way to do this. Once a post is submitted, it fades into a div and both users can see it, not only the user who submitted it, so it is like a facebook chat in a way. I have no idea about any possible solutions, and have done research, but I could not find any that i could get to work. Any help and/or insight to what I should do next would be appreciated.

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

    What you are looking for is ajax long pulling, also called Comet (it’s a silly pun). The basic idea is simple–instead of polling the server, you send your ajax request and the server blocks on it until it gets a new message.

    “Blocking” here simply means it does not send a response. You get your request then first up a thread (is that what you would do in PHP? I’ve only ever used node.js for this) and wait until something changes before sending the response back to the client.

    Once the client has a response, it sends another request immediately.

    There is one other trick: requests can time out. This means that the server should send a response back after a certain time even if nothing has updated.

    This methodology is good if you have to support older browsers; if you can ignore those and stick to newer ones, you can use “websockets”.

    There are libraries that help you use websockets or fall back on Comet. I think the most popular one is socket.io.

    Coincidentally, if you’re not tied to PHP, I really suggest using a different server. node.js is a great option–it is a natural fit for this sort of problem and you can write the server-side code in JavaScript, which you already know. Even Facebook–the bastion of PHP–used a different language (Erlang) for their chat backend.

    So, in summary: use socket.io. If you can, try using a different backend, although PHP is fine too.

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

Sidebar

Related Questions

Going through Lynda's 2010 tutorial on rails and have been stuck on migration for
I have been trying to maintain session vars between two subdomains and found it
Going through the Game Center / GameKit docs, I could not find any information
Going from Rails to ASP.net has been quite a pain. But I was wondering
Last night before going to bed, I browsed through the Scalar Data section of
Going through Javascript documentation, I found the following two functions on a Javascript object
Going round in circles here i think. I have an activity called Locate; public
Going mad now. I have a MVC solution that i've upgraded from MVC 1
Going through the microsoft authentication tutorial listed here they have you create a master
Going through the SproutCore Getting started tutorial and have a problem. Inside the Todos.todoListController

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.