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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:08:01+00:00 2026-06-15T07:08:01+00:00

I being new to php/mysql , have decided to implement a simple chat application.

  • 0

I being new to php/mysql, have decided to implement a simple chat application. Here are some specific questions..


1)
In facebook, if i send a chat message, it updates the chat log using javascript but it will also come up with a “failed to deliver” mark after some time if the connection is lost. My question is how to check if connection to the server is established before sending the message using AJAX/jquery so that I too can inform the user that his message wasn’t delivered.


2) Consider this simplified scenario.. The chat room has 2 slots, that is, only 2 people can share the chat room and chat with each other at any time.. In case a third user tries to login, he will be informed that chat room is full. I can store the user’s login data as session variables or something like that. My question is this… If 2 people are already chatting and one guy just closes the browser without logging out or anything like that… In that case, the session variable is still present and the application still considers 2 people are chatting in the room.. How to delete the session variable if the user is not active in the browser window and make room for the 3rd guy to come in?


3) How do chat applications (like fb chat and google chat) update their chat log? do they request entire chat log (say consisting of 10 messages) or do they just request the current messages using AJAX? And what would be the ideal duration for each requests? I am using 1 second…

  • 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-15T07:08:03+00:00Added an answer on June 15, 2026 at 7:08 am

    1) In jquery ajax callback function tells you if error ocurred:

    $("#form").submit(function(){
        $.post("post.php", {
            message: $('#field').val(),
        }, function(data, status){
            alert("success");
        }).error(function(){
            alert(error);
        });
    });
    

    See http://api.jquery.com/jQuery.post/

    2) You can periodically poll (like every minute) the server and if user don’t contact server, destroy his session or send disconnect command to server when onunload is fired (not so reliable).

    3) I would send server the timestamp or id of last image and it would send me back all messages since then.

    It depends on how much “real-time” you want your chat. 1 second to 10 seconds is ideal.

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

Sidebar

Related Questions

I have a PHP MySQL application which has a modular design. There are about
I'm new to PHP, HTML and MySQL, and have encountered the following problem: I
Hi I am quite new to php but i have been following some tutorials
We have an existing application that runs on php and mysql. We are in
I have decided to create a new table in my database that will be
First of all, I am still very new to PHP / mySQL so excuse
I'm building a very small web ERP application with PHP / mySQL / CodeIgniter
based on How to implement tagging system similar to SO in php/mysql? ive made
This is for MySQL and PHP I have a table that contains the following
I am working on a web-application in PHP-MySQL. I am MySQLi API for database

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.