'how i can fix this elephant.io connection probelm

My client interconnection socket = io.connect('http://localhost:3000', { transports : ['websocket'] });

Before adding transport, it was not connecting on the client side transports : ['websocket'] fixed after adding.

now i am trying to connect with elephant.io

but I am getting error as below

Message: An error occurred while trying to establish a connection to the server Filename: C:\AppServ\www\test\vendor\wisembly\elephant.io\src\Engine\SocketIO\Version1X.php Line Number: 187

Backtrace:

File: C:\AppServ\www\test\vendor\wisembly\elephant.io\src\Engine\SocketIO\Version1X.php Line: 48 Function: handshake

File: C:\AppServ\www\test\vendor\wisembly\elephant.io\src\Client.php Line: 60 Function: connect

File: C:\AppServ\www\test\application\controllers\Messages_controller.php Line: 33 Function: initialize

File: C:\AppServ\www\test\index.php Line: 315 Function: require_once

Versin2x using.

$options = [
    'context' => [
        'ssl' => [
            'verify_peer' => false,
            'verify_peer_name' => false
        ]
    ]
];

$client = new Client(new Version2X('http://localhost:3000',$options));
$client->initialize();

Could I be experiencing an error because localhost does not have ssl? or could it be an error from file_get_content.

I can't find a solution anymore, I will be very grateful to anyone who can help

Framework : codeigniter 3x



Solution 1:[1]

I had a same problem, I am using node as server and elephant.io for connecting client to server.

I changed my socket version in package.json file from 3.0.0 to 2.2.0 and solved it. if it will help you can try.

elephant io will not work more with version 3 or more.

UPDATED:

I find out solution in github for socket connetion with more than version 3.

Here is it.

https://github.com/tohenk/elephant.io

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1