Open kevinblade opened 8 years ago
As you mentioned, the warning comes from here, notifying that "Socket connection failed for unknown reason". Maybe @jondubois has any clues why it's unknown reason
or how to debug it further.
@kevinblade If you modify https://github.com/zalmoxisus/remote-redux-devtools/blob/master/src/devTools.js#L203 to listen to the 'disconnect' event like socket.on('disconnect', function (statusCode, reason) {});
what is the statusCode - Also check the reason?
@zalmoxisus Basically it means that the SC client received a status code that it didn't understand. Since v5 of the client, it should provide a better description for these errors (in v5 it should provide the reason as part of the 'error' message). In v4, you have to listen to the 'disconnect' event to get the reason.
@jondubois As you mentioned I tried to test with 'disconnect' event handler. But the statusCode and reason are 'unknown' too. I don't know what it is. Did you have done it?
@zalmoxisus @kevinblade Maybe it's related to the fact that the SocketCluster client and server versions are different. v4 client should be compatible with v5 server but this might be an edge case.
It sounds like there are two problems here:
You can try upgrading the socketcluster-client
dependency to v5.0.9
and see if that fixes things (or at least it should show you a proper error).
Maybe it's just that the hostname is incorrect and the client cannot reach the server or something like that.
@jondubois I tested with your recommendation my local remote-redux-devtools's socketcluster-client dependency is upgraded to v5.0.9. But this problem is not discovered or cleared. How can I fix it? I want to use this package so I need your help.
I fixed this problem. ^^ My fixing is as follows.
Step 1: Downgrade the version of remote-redux-devtools to 0.3.3 and remote-redux-devtools-on-debugger to 0.5.1 Step 2: Reinstall above two packages. Step 3: Change socketcluster's version to 4.3.1 in remotedev-server's package.json. Step 4: Remove socketcluster in remotedev-server and then npm install in remotedev-server for reinstall it.
That's it. But after that I don't know reason why I can't use --injectserver for postintall option in root package.json so I use --runserver. Thank you @jondubois for your mentions that is a good hint for my fixing. Anyway I can use this useful package on my project.
@kevinblade, what versions of remotedev-server
, socketcluster
and socketcluster-client
do you have now?
In my case, these combinations are correct. I changed local remotedev-server's package.json for downgrading of socketcluster from 5.0.4 to 4.3.1 and then reinstall remotedev-server's modules. After that my problem was cleared.
@kevinblade, thanks for clarifying that. So, the problem comes from socketcluster@5
.
I tested using the socketcluster v5.0.11 (socketcluster-server 5.1.0) and socketcluster-client v4.3.19 and it's working correctly for me (even with the client version mismatch).
The only way I was able to reproduce the Uncaught Socket error - SocketProtocolError: Socket connection failed for unknown reasons
was by disconnecting the socket from the server side using socket.disconnect(4222)
(where 4222 is a custom error code I made up) - That's expected though because if you use a custom error code without providing an error message as second argument, the client won't recognize it will just emit an unknown error. You can call socket.disconnect()
without arguments - Then the statusCode will be 1000 which is the default.
I'm not sure if that's the problem in this case though.
Could it be because the SC server and client versions are different?
@jondubois, I'm using it without problems as well, but for web apps, not React Native. The worker code is pretty simple. Maybe you can spot any problems there?
@kevinblade, is the problem only when using injectserver
argument? Does that happens when using runserver
with the initial lib?
@kevinblade, I just shipped 0.4.8
of remote-redux-devtools
. It should reconnect when such errors occur. Also the errors appear only in the console now. Please let me know whether it helps.
@zalmoxisus It looks fine at first glance.
@zalmoxisus Yes, injectserver argument produces the problem which is babel parsing error but runserver is not.
Yes, injectserver argument produces the problem which is babel parsing error but runserver is not.
@kevinblade could you provide your React Native version? I can't get some parsing errors for injectserver
argument.
@jhen0409 My RN version is 0.32.1
Is there a recommended fix for this?
@mmmurf, could you provide a repo to reproduce the problem? Or you could try to reproduce it with this example and provide steps so I could replicate and investigate that.
To debug it yourself, use remotedev-server
, so you'll see what causes the issue on backend.
@zalmoxisus sure I'll do one of those things asap.
I'll try to get my hands on a Mac this week to debug SC with RN. Last time I tried setting up RN on Ubuntu, it was a disaster.
@jondubois I'm using a mac but cannot reproduce it unfortunately. Maybe @mmmurf can reproduce it with the example I indicated above and provide some steps.
I encountered the error on my RN app. When this error occur the React Native Debugger's Inspector is cleared. I think this problem is related other node modules but I can't find what it is. Stacktrace shows source code location is devTools.js:219 in remote-redux-devtools module. What's the problem?