3

I need communicate php to NodeJs (Socket.io) Server. I find i library about it. But i can't recieve data. The library name is Elephant.io. There is some way to communicate Php and Socket.io ? I need it. I need Send data and Recieve data.

This is my Library -> https://github.com/Wisembly/elephant.io

But it doesn't work.

This is my code block and i get this error ;

$client = new Client(new Version1X('http://192.168.1.4:150/'));
$client->initialize();

while(true)
{
    $r=$client->read();
     if (!empty($r)) {
        echo $r;
    }
}

$client->close;

This is Cmd error;

PHP Notice:  Undefined offset: 2 in C:\xampp\htdocs\SocketClientExample\src\Engine\AbstractSocketIO.php on line 122

    Notice: Undefined offset: 2 in C:\xampp\htdocs\SocketClientExample\src\Engine\AbstractSocketIO.php on line 122
    PHP Notice:  Undefined offset: 2 in C:\xampp\htdocs\SocketClientExample\src\Engine\AbstractSocketIO.php on line 123

    Notice: Undefined offset: 2 in C:\xampp\htdocs\SocketClientExample\src\Engine\AbstractSocketIO.php on line 123
    PHP Notice:  Uninitialized string offset: 1 in C:\xampp\htdocs\SocketClientExample\src\Payload\Decoder.php on line 95

    Notice: Uninitialized string offset: 1 in C:\xampp\htdocs\SocketClientExample\src\Payload\Decoder.php on line 95

I want to another Library for it. Do have anyone know something about it ?

  • `Socket.io` is kind of wrapper around `websocket`. You can't directly communicate with `socket.io` server with any `websocket` client. You need `socket.io` client for that. You can try https://github.com/walkor/phpsocket.io . as `php` `socket.io` client. – Mukesh Sharma Jan 25 '17 at 21:02
  • I have a Socket.io client sir.. I made the Server and Client code but I cant recieve data.. I can send some data from my client to server but cant recieve – Erkan Erikli Jan 25 '17 at 22:38

0 Answers0