gourykr / phpwebsocket

Automatically exported from code.google.com/p/phpwebsocket
0 stars 0 forks source link

multiple client #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. At same time, more than 1 client is not possible to send message. 

2.

3.

What is the expected output? What do you see instead?
Any number of clients should be able to send and receive message.

What version of the product are you using? On what operating system?
2.0

Please provide any additional information below.
None

Original issue reported on code.google.com by shivam0...@gmail.com on 13 Mar 2010 at 1:26

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
You can add a sendAll function that loops through the users array and sends a 
write 
to each socket in the array. The following is a quick way to do that:

function sendAll($msg){
    global $users;
    $msg = wrap($msg);
    foreach ($users as $eachUser) {
        socket_write($eachUser->socket,$msg,strlen($msg));
        say("User ".$eachUser->id." > ".$msg);
    }
}

EDIT: Fixed typo

Original comment by kryptyx on 30 Apr 2010 at 4:03

GoogleCodeExporter commented 8 years ago
I have done some coding. I have modified the code so that multiple client can 
run at the same time. each send and receive msg at the same time.

Here is the code - http://vgsr.posterous.com/group-chat-via-phpwebsocket
My email id = narendra@narendrasisodiya.com Can I comit the changes ?

Original comment by narendra.sisodiya on 10 Jul 2010 at 4:15