Results 1 to 4 of 4

Thread: suggestions on creating instant messaging

  1. #1
    Join Date
    May 2007
    Location
    Canada
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default suggestions on creating instant messaging

    Hi,

    I wasn't sure exactly in which forum I should post, but let me know. As the title suggests, I want to create a chat client that is web based.

    I know I can use ajax to post messages to the database and then using ajax display new messages. The way displaying will work is if I send a request every 1 or 2 seconds to check the database for new message and then display it.

    But that's really not instant messaging, if you know what I mean. Is there any alternatives so that after someone posts something it will appear on message display without needing to wait for the server to receive a request and then display it?

  2. #2
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    79
    Thanks
    0
    Thanked 15 Times in 15 Posts

    Default

    Nope. Not while using PHP and Javascript exclusively at least. You can however increase the refresh time enough that the lag is minimal. I wrote a chat application like this for my community using ajax, php and xml. It worked pretty well even with a 2.4 second refresh lapse.

    Anyways, I don't believe what you're looking for is possible with PHP. Most instant messaging clients work by downloading the ip address and port of the clients you communicate with to your machine. That way your messages are relayed to the other person directly with no server in between. As far as I know, this is not possible without installing software on the user's machine.
    Last edited by jackbenimble4; 02-08-2008 at 03:54 AM.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This is possible using a java applet as done with irc chats. However, it's not possible with just javascript/php as js is limited to person-machine and php is limited machine-machine (aside from the actual request and output which are person-machine).
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    May 2007
    Location
    Canada
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks everyone for your reply. I was also thinking the same, but thought I would ask to make sure.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •