php socket daemon, 2nd window tab not being processed until broadcast is sent out
So I have written a daemon in php and it worked great until I opened two tabs in the same browser and then this error started happening. The 2 tabs were treated as the same socket because when a message is sent the first tab gets the message but the 2nd doesnt until another messa开发者_运维问答ge is sent. So if 3 tabs are open it alternates between the 3. Is there any way to solve this?
Links to Daemon and Client: Daemon Client Command Line: php z.daemon.php
Just 2 tabbed windows: client.php?action=listen Then run: client.php?action=broadcast&broadcast=test
-- Edit -- Also, the 2nd tab window which is listen does not even show its connected as a client in the commandline output.
-- Edit -- Basically is there a way to send unique ids to socket_select to help it figure out if its a new or not?
Genreate an random id on page load and use that to identify the individual clients with the query string.
精彩评论