Server-Sent Events with multiple users
问题 I'm attempting to write a chat program with the new Server-Sent Events API, however, I've been having trouble figuring out how to send different users different events. With all the code occurring out of one PHP file, I'm unsure the best way to send only certain events to each user. Any help you can give would be greatly appreciated. (I'm working in PHP and Javascript) 回答1: Lets say the following is your sender.php code (one php file) echo "event: ping\n"; $msg1="This is first user"; echo