Jump to content

Need help with shoutbox....


gaza165

Recommended Posts

 

Hi all,

 

I have been working on a shoutbox for ages, from the feedback i have been getting is that the problem with it is that messages take to long to be displayed.

 

Currently

 

1.) Users write a message and send it.

2.) It then is added to the database.

3.) Every 3 seconds a call to a php file called ajaxgetshoutbox.php is called to get the last message posted.

4.) This data is then put into JSON format.

4.) This is then outputted to the screen.

 

Obviously i cant put to much pressure on the server by posting a request to the database every second.

 

Have i gone about this all the wrong way?

 

Is there a way to improve responsivness of message sending??

 

If anyone would like to look at the code, please ask. Or you can view it live at http://shoutbox.thedesignmonkeys.co.uk

 

thanks

 

Garry

Link to comment
https://forums.phpfreaks.com/topic/156795-need-help-with-shoutbox/
Share on other sites

Well, you can have ajaxgetshoutbox.php remove the first x DB entries. In a shoutbox, you only need to keep the last 30 shouts at most (I think). It's up to you. If it's more than 30, delete the first x amount of shouts so the last 30 remains. That should help performance and querying.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.