ratchetphp / Ratchet

Asynchronous WebSocket server
http://socketo.me
MIT License
6.28k stars 743 forks source link

Set time delay in Socket Messages #716

Open josephmiller2000 opened 5 years ago

josephmiller2000 commented 5 years ago

When we reach 400+ users at a time in our chat room, there is a bit delay in sending messages.

  1. When we send a message, it goes through several process and appear on the chat screen in real time. Due to this process, when all those 400+ in the room keep sending message through socket will overload the chat.

  2. Instead of doing this? why can't we set a time delay for message to appear on other users screen, but the message should appear on SENDER screen instantly.

  3. If we do this, we can send multiple messages at same time and it will avoid overloading the process.

I have seen a php chat room without websocket, can hold more than 700+ users at a time without lagg in the messages. They set a 1500ms delay in message or refresh .

cboden commented 5 years ago

See EventLoop's addTimer