gaza165 Posted May 4, 2009 Share Posted May 4, 2009 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 More sharing options...
Ken2k7 Posted May 4, 2009 Share Posted May 4, 2009 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. Link to comment https://forums.phpfreaks.com/topic/156795-need-help-with-shoutbox/#findComment-825741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.