Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Connection Error #179

Open
mmt78 opened this issue Dec 18, 2018 · 22 comments
Open

Connection Error #179

mmt78 opened this issue Dec 18, 2018 · 22 comments
Labels

Comments

@mmt78
Copy link

mmt78 commented Dec 18, 2018

When I try to node server, I get the error below:

Fatal error: Uncaught ElephantIO\Exception\ServerConnectionFailureException: An error occurred while trying to establish a connection to the server in /var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php:187 Stack trace: #0 /var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php(48): ElephantIO\Engine\SocketIO\Version1X->handshake() #1 /var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Client.php(60): ElephantIO\Engine\SocketIO\Version1X->connect() #2 /var/www/html/shared/classes/socket.class.php(24): ElephantIO\Client->initialize() #3 /var/www/html/dashboard/news.php(83): Socket->__construct() #4 {main} thrown in /var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php on line 187

It is strange that when I use Version 2X still I get the same error. Actually it connects the server but throw the error and stop working.

@Taluu
Copy link
Contributor

Taluu commented Dec 19, 2018

Please catch the exception and dump the content of getErrorMessage().

@Taluu Taluu added the support label Dec 19, 2018
@mmt78
Copy link
Author

mmt78 commented Dec 19, 2018

getErrorMessage() function returns NULL. When I dump the content of '$e(error)', I get the line below:

object(ElephantIO\Exception\ServerConnectionFailureException)#39 (8) { ["errorMessage":"ElephantIO\Exception\ServerConnectionFailureException":private]=> NULL ["message":protected]=> string(70) "An error occurred while trying to establish a connection to the server" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(92) "/var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php" ["line":protected]=> int(187) ["trace":"Exception":private]=> array(3) { [0]=> array(6) { ["file"]=> string(92) "/var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Engine/SocketIO/Version1X.php" ["line"]=> int(48) ["function"]=> string(9) "handshake" ["class"]=> string(36) "ElephantIO\Engine\SocketIO\Version1X" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [1]=> array(6) { ["file"]=> string(73) "/var/www/html/shared/socket-io/vendor/wisembly/elephant.io/src/Client.php" ["line"]=> int(60) ["function"]=> string(7) "connect" ["class"]=> string(36) "ElephantIO\Engine\SocketIO\Version1X" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [2]=> array(6) { ["file"]=> string(32) "/var/www/html/dashboard/news.php" ["line"]=> int(98) ["function"]=> string(10) "initialize" ["class"]=> string(17) "ElephantIO\Client" ["type"]=> string(2) "->" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL }

I am using Version2X but why am I getting error about Version1X?

@indigoram89old
Copy link

I have the same error...

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

Do you also have the result of getErrorMessage() to null ?

@indigoram89old
Copy link

indigoram89old commented Apr 5, 2019

Yes, I have

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

Which version are you using ? dev-master or 3.1 ?

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

Sorry, meant 3.3

@indigoram89old
Copy link

"wisembly/elephant.io": "^3.3",

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

Could you then try with dev-master ? I'll try to do a release when I'll have enough time to do it...

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

And if that doesn't work, could you remove the @ on https://github.com/Wisembly/elephant.io/blob/master/src/Engine/SocketIO/Version1X.php#L196 ?

@indigoram89old
Copy link

dev-master is not working

@indigoram89old
Copy link

img-2019-04-05-18-04-53

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

OK now that is strange. It seems that the resource is already busy with something else (probably socket.io ?).

Could you maybe try a ping on that adress / resource ?

BTW, not really sure but your uri looks strange (it shouldn't be escaped : use_b64=0&EIO=...) but maybe it's the error message that does that.

@indigoram89old
Copy link

yes, the error message does that

@indigoram89old
Copy link

I try the same code on the server (DO) and it's working.
But I have the error on my local machine (mac os).

@Taluu
Copy link
Contributor

Taluu commented Apr 5, 2019

Got no clue then on why this happens, especially as I don't have a mac. Sorry :/

@indigoram89old
Copy link

Thanks anyway and good luck!

@peter279k
Copy link
Contributor

I change the socket IO server dependencies and it's worked successfully.

It can look at the PR #186 to know more details.

@indigoram89old
Copy link

Wow, I have found my mistake!

The trouble in ini_set("default_socket_timeout", -1);

This line was in another package which uses the elephant.io package.

Thank you guys!

@peter279k
Copy link
Contributor

I think we don't let the default_socket_timeout be-1 because this will always try connecting the socket server until the connection is established.

@daryn-k
Copy link

daryn-k commented Oct 3, 2021

I have the same error. Even more, this error occurred accidentally, I didn't change anything. Everything works fine in localhost, in NodeJS, in browser ... But the real server doesn't accept any connections from PHP Client. It's so weird, I have no clue.

@akshayb007
Copy link

Hii there,

I am facing the same issue in ubuntu with php8. Everything is working fine in nodejs and browser. But not working when emit the event from laravel php.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants