elephant.io icon indicating copy to clipboard operation
elephant.io copied to clipboard

Undefined index: upgrades

Open sclearion opened this issue 9 years ago • 4 comments

Getting this error:

Undefined index: upgrades
/var/www/html/ClearionLabsPHP/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php:153
/var/www/html/ClearionLabsPHP/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php:48
/var/www/html/ClearionLabsPHP/vendor/wisembly/elephant.io/src/Client.php:59
/var/www/html/ClearionLabsPHP/main/SocketHelper.php:14
...
...

from elephant.io/src/Engine/SocketIO/Version1X.php Line 153:

...
if (!in_array('websocket', $decoded['upgrades'])) {
      throw new UnsupportedTransportException('websocket');
}

Here is my initialization in SocketHelper.php:

$client = new Client(new Version1X($url));
$client->initialize();
$client->emit($event, $msgBody);
$client->close();

sclearion avatar Jun 02 '15 19:06 sclearion

What's the result of the $result ?. Just print it before the line :

$decoded = json_decode(substr($result, strpos($result, '{')), true);

vincentdieltiens avatar Jun 04 '15 07:06 vincentdieltiens

ping @sclearion, could you print out the result as @vincentdieltiens suggested ? Thanks !

Taluu avatar Sep 12 '15 12:09 Taluu

Hi. I have the same problem. I can connect to my Socket.IO server with JavaScript, but with PHP it fails with a "400 Bad Request Error". I'm using the Elephant.IO Bundle for Symfony (nc/elephantio-bundle v2.0.0) which is requiring wisembly/elephant.io v3.0.* I don't get any other response than "Bad Request - Your browser sent a request that this server could not understand."

txptr avatar Sep 17 '15 08:09 txptr

Is this the result of the $result variable ? Could you try to checkout the master version, as it was not released yet ?

Taluu avatar Sep 17 '15 09:09 Taluu