Search code examples
phpajaxchatlimitbandwidth

Server Bandwidth Limit issue in chatting system


I have created a management system that is now having issues with bandwidth usage. I think the problem is with the new chatting system that I have attached to it. But there could be other problems like viruses or any other thing with my hosting.

Bandwidth before attaching chat system: min 200MB / max 700MB Bandwidth after attaching chat system: min 3.5GB / max 5GB

Chat System: it is an end-to-end database-supported PHP chat system I think the issue is that it checks every 0.5s for a new message using an ajax call but I don't know what to do now.


Solution

  • It is definitely problem with your chat system, I came across with the same issue in my system when I implemented a chat system in a wrong way which is that I generate a request after every 1min and it just ate my bandwidth within days...

    What is the solution? The solution to this problem is to implement sockets. https://phppot.com/php/simple-php-chat-using-websocket/

    you have to create a socket which will listen to your every client request in background and then it will send the messages to users if any message is received on receiving socket. You can follow above tutorial. It can also be implemented using libraries, you can find some good libraries on google.