SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: Lagging Chat..

  1. #1
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    Wheelersburg
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lagging Chat..

    I am creating a chat, and it works mint with one person in it. However it lags when two people get on. Is there anything I should be doing to make it work for more than one person? I have seen something about sockets or something, and have never heard of these, but maybe they will help. Any ideas how I could make it so it works with more than one?

    Here is how I am doing my chat..(Php/Mysql/Flash)

    Whenever you enter, there is nothing on the chat.

    You start a loop, and with that loop I load check.php. This checks to see if a new message has been posted. Whenever you push the send button, a variable will be changed to true, that's how it checks. Well, if it is set as true then it loads a file called new.php. This new.php reads the last line of mysql database and returns it.

    Very simple actually, but it gets really lagged and stuff whenever a new user gets on(meaning two people on the chat)

    Do you know, or know any resources, that would tell me how I can make a chat speed up with more than one person. Or some way of handling more than one user with live updates and stuff?


    Edit: You can view it here: http://www.chaseschwalbach.com/chat/ It is still buggy, like you may have to push enter twice to make the login work and stuff, but the chat is fine unless there are more than one person. The design was made by dsi.lord, and I did all programming

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Think about how many times that php script is being hit, and even when there is nothing happening its still hitting it.

    IMHO a chat likes this is horribly inefficient. You need to look into a socket server of some kind that can do server push.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2004
    Location
    Wheelersburg
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    I know this, and that's what I am asking for help with. What exactly do I need to look into? Can you guide me to what I need to know, like any tutorials or anything? Thank you.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well for socket servers you can look at http://www.php-tools.de/site.php?fil...r/overview.xml


    Then look for tutorials on the XMLSocket object in flash.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Zealot
    Join Date
    May 2003
    Location
    Midwest
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://forums.cyberlot.net/viewtopic.php?t=3

    A extremely basic flash socket server ready to use with flash... Soon as I get my flash chatroom cleaned up ( has a bunch of extra stuff added ) I will be posting that as well.

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No offense cyberlot, I looked at your code and it not very organized. The thing I like about patServer(link above) is it very well written, easy to use and has API documentation.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Zealot
    Join Date
    May 2003
    Location
    Midwest
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by freddydoesphp
    No offense cyberlot, I looked at your code and it not very organized. The thing I like about patServer(link above) is it very well written, easy to use and has API documentation.
    No offense taken

    It is extremely simple and was put up because a couple people I know needed examples of socket servers. It doesn't have docs because there is no API, Its a socket server thats it plain and clear.

    I could put docs together but they would consist of

    chmod 755 xmlengine.php
    ./xmlengine.php &

    If you want a base socket server to customize 100% pretty much from scratch and not have to worry about the overhead of extra functions and API stuff you don't need then its perfect.

    If you just want to learn a bit about socket servers its great.

    If you want need a easy API and functions to help you develop an application then its the wrong thing for you and I would tell you to download patServer.


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
  •