This repository was archived by the owner on Aug 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 331
This repository was archived by the owner on Aug 25, 2022. It is now read-only.
Using Version2X but getting a Version1X error ? #216
Copy link
Copy link
Open
Description
Hi, I'm trying to emit an event from a php controller with elephant io by using version2X but I get a version1x error.
Here is what my code looks like :
$socket = env('HTTP_PROTOCOL').'://'.env('URL_SOCKET').':'.env('PORT_SOCKET_MESSAGES');
$client = new Client(new Version2X($socket));
$client->initialize();
$client->emit('message', [
'message' => 'some message',
]);
$client->close();
It works on my local machine (using wamp) but does not on the dev server.
It return me this error :
"name": "PHP Warning",
"message": "file_get_contents(<my_url>/socket.io/?use_b64=0&EIO=3&transport=polling): failed to open stream: Connection refused",
"code": 2,
"type": "yii\\base\\ErrorException",
"file": "<app_url>/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php",
"line": 177,
"stack-trace": [
"#0 [internal function]: yii\\base\\ErrorHandler->handleError(2, 'file_get_conten...', '<root_url>/...', 177, Array)",
"#1 <app_url>/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php(177): file_get_contents('<url>', false, Resource id #39)",
"#2 <app_url>/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php(48): ElephantIO\\Engine\\SocketIO\\Version1X->handshake()",
"#3 <app_url>/application/vendor/wisembly/elephant.io/src/Client.php(60): ElephantIO\\Engine\\SocketIO\\Version1X->connect()",
"#4 <app_url>/application/controllers/ApiController.php(382): ElephantIO\\Client->initialize()",
"#5 [internal function]: app\\controllers\\ApiController->actionMessages('940833739', '701165609')",
"#6 <app_url>/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)",
"#7 <app_url>/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)",
"#8<app_url>/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction('messages', Array)",
"#9<app_url>/vendor/yiisoft/yii2/web/Application.php(103): yii\\base\\Module->runAction('api/messages', Array)",
"#10<app_url>/vendor/yiisoft/yii2/base/Application.php(384): yii\\web\\Application->handleRequest(Object(yii\\web\\Request))",
"#11 <root_url>/index.php(24): yii\\base\\Application->run()",
"#12 {main}"
]
Do you know why it would use Version1X although I'm using Version2X and why this error happens ?
Metadata
Metadata
Assignees
Labels
No labels