You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello guys..
i working at this library and i see that i can connect and disconnect to the nodejs socketio Server with this code but i have one problem, the emit the event didnt work .. i try to google it and i didnt find anything so i fixed by my some experiences so i let you guys use it if having same problem.
and also i add some delay after handshake ,before emit like this:
sleep(1);
**and this is my test that its the same with original example:
<?php
include_once ('socket.io.php');
$socketio = new SocketIO();
if ($socketio->send('**XXX.XXX.XXX.XXX**', **XX** ,$action,$data)){
echo 'we sent the message and disconnected';
} else {
echo 'Sorry, we have a mistake :\'(';
}
?>
you must replace the XXX.XXX.XXX.XXX and XX with your server ip and port.
Thanks for read.
The text was updated successfully, but these errors were encountered:
### Oh i forgot to say that at the example code you must set the $action and $data to your Event name and Your data that you need to be send like this:
<?php
include_once ('socket.io.php');
$socketio = new SocketIO();
if ($socketio->send('**XXX.XXX.XXX.XXX**', **XX** ,"message","Hello World!")){
echo 'we sent the message and disconnected';
} else {
echo 'Sorry, we have a mistake :\'(';
}
?>
hello guys..
i working at this library and i see that i can connect and disconnect to the nodejs socketio Server with this code but i have one problem, the emit the event didnt work .. i try to google it and i didnt find anything so i fixed by my some experiences so i let you guys use it if having same problem.
this is the final socket.io.php file:
i changed these
'42["' . $action . '", "' . addslashes($data) . '"]'
to
'42["' . $action . '", "'.$data. '"]'
and
/socket.io/?EIO=3
to
/socket.io/?EIO=2
and also i add some delay after handshake ,before emit like this:
sleep(1);
**and this is my test that its the same with original example:
you must replace the XXX.XXX.XXX.XXX and XX with your server ip and port.
Thanks for read.
The text was updated successfully, but these errors were encountered: