remote-redux-devtools
remote-redux-devtools copied to clipboard
{name: "SocketProtocolError", message: "Socket hung up", code: 1006}
Thanks for the report. Could you please check what version of sc-broker-cluster
do you have installed? It seems related to https://github.com/SocketCluster/sc-broker-cluster/commit/ea5e7ba7ad5a46cd14ed1ff502120f5361af54fb, though I don't see stringify
function in use.
\cc @jondubois
@zalmoxisus @mingkang1993 the dependency sc-broker-cluster
should be v2.1.6
or later. Maybe an earlier version was cached by npm from an earlier install? @mingkang1993 Try reinstalling/updating the dependency after doing npm cache clean
.
i've got a same error:
{
code:1006
message:"Socket hung up"
name:"SocketProtocolError"
...
}
my sc-broker-cluster
is v2.1.7
@markortiz Do you also get "...stringify is not a function" on the server side? Are you running it over the network; if so, are you using plain HTTP/WS (not encrypted)?
Some corporate networks can block plain WebSocket traffic; the solution is to serve it over HTTPS.
Another thing that you can try is check that you're using the latest versions of https://www.npmjs.com/package/socketcluster and https://www.npmjs.com/package/socketcluster-server
Annother thing to check are your settings to make sure that it's connecting to the correct server URL. This error just means that the server was lost or could not be found (including blocked by a proxy).
@jondubois I'm just trying to run my react-native on local, here attached error screenshot:
Its still appear after updating socketcluster
@markortiz Did you run npm cache clean
and then reinstall remote-redux-devtools (and socketcluster)?
I cannot reproduce this - Maybe there is an old subdependency that is cached and not updating correctly.
@jondubois I fix it by deleting node_modules
and run npm install
again and that error was gone.
However it seems that I can't see any state
nor actions
on my Redux Devtools extension on chrome which I think a separate issue.
Thanks for the help! :)
@markortiz did you open Remote DevTools?
In case you're running a local server (which is recommended), don't forget to specify the host and port for the extension by clicking the Settings button there.
@zalmoxisus yes, I'm using "remotedev-server": "^0.2.0"
and run remotedev --hostname=localhost --port=8000 --injectserver=reactnative
then run react-native run-android
and I cant see any activities on Redux Devtools
Did you specified host and port on both the extension and remote-redux-devtools
(and don't forget about realtime
parameter)?
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'remote-redux-devtools';
const composeEnhancers = composeWithDevTools({ realtime: true, port: 8000 });
const store = createStore(reducer, /* preloadedState, */ composeEnhancers(
applyMiddleware(...middleware),
// other store enhancers if any
));
Just in case also run adb reverse
(though it shouldn't be necessary when having injectserver=reactnative
).
@zalmoxisus thanks for your help! adb reverse
was able to solve the problem. :)
I also ran into this when attempting to connect on an iOS device, and it was caused by a mismatch between the dev server's configuration and the store enhancer. I had:
devTools({hostname: '10.0.0.4', port: 8000})
and
$ remotedev-debugger --hostname=localhost --port=8000 --injectserver=reactnative
Once I made the hostname of the shell command match, all worked :)
I am experiencing the same WS error (1006
, Connection Refused) when attempting to load the tools via a Django-hosted application:
WebSocket connection to 'ws://localhost:8181/socketcluster/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
The relevant lines in my store look like this:
import {composeWithDevTools} from 'remote-redux-devtools';
/* ... */
// DevTools setup
const composeEnhancers = composeWithDevTools({realtime: true, port: 8181});
const store = createStore(
rootReducer,
initState,
composeEnhancers(applyMiddleware(thunk))
);
Per the above posts, I am using sc-broker-cluster
v4.0.0.
None of this works even if I set the tools to use local hosting on any port or even when I attempt to match hostnames between the web server and the devtools.
@darth-cheney, make sure your server is available on http://localhost:8181
.
I am using atom-redux-devtools
and have attempted to match the hostname/port settings as in the store, but no dice. My understanding was that atom-redux-devtools
took care of the server part -- is that not the case? Either way I cannot get this to work eve with the plain remotedev.io.
I'm wondering now if this is at all even possible, since my webserver is Django and I cannot simply import a remotedev-server to start myself
@darth-cheney, if you don't use remotedev.io
(which is by default), you should install and start remotedev-server
:
npm i -g remotedev-server && remotedev --port=8181
or if you don't want to install it globally:
npm i --save-dev remotedev-server && ./node_modules/bin/remotedev --port=8181
It's not trivial to integrate it in an atom package, see https://github.com/zalmoxisus/atom-redux-devtools/issues/1.
Ok I'll try to keep this as the last post, since it's veered off topic.
Initially, I tried the default (remotedev.io
) and my store looked like this:
import {composeWithDevTools} from 'remote-redux-devtools';
/* ... */
const store = createStore(
rootReducer,
initState,
composeWithDevTools(applyMiddleware(thunk))
);
Additionally, I had NODE_ENV
set to development
(even though this isn't a node server).
However, nothing worked in either atom-redux-devtools
or the remotedev.io
development tools. Everything stayed blank and there were no warnings anywhere. I'd prefer not to run a custom server if I don't have to, but went down that road when nothing was happening. Any other ideas?
Make sure to set process.env.NODE_ENV
. For Webpack you should add it as following:
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
]
You can just set realtime
to true
or to other global variable to turn it off in production. If you don't specify port
parameter, it will use remotedev.io
. Also make sure not to switch to a local server in Settings of the monitor app (either in Atom or on remotedev.io/local
).
You might also want to try our examples.
If you're using it for React Native, there's React Native Debugger, which already includes both the server and remote-redux-devtools
.
Feel free to provide more info, I'd happy to help.
Yup, I'm an idiot. Needed to set NODE_ENV
on the build for the JS bundle!
Thanks @zalmoxisus, this is working now. Much appreciated.
@darth-cheney no probs. I added the info to the README.
@zalmoxisus Man I've been at this for hours and cannot get this package to work with react-native run-android. As soon as I added remotedev-debugger --hostname=localhost --port=8000 --injectserver=reactnative
as a postinstall script in my RN-redux app it cannot build.
I get the error described above while building my app or even using the remotedev packages' remotedev --hostname=localhost --port=8000
command directly. It says something about installing C++ compiler, do I need that? No docs say I need this. I've done the adb reverse thing and it does not help.
The error comes from socketcluster-server\scserver.js.
@SSTPIERRE2 Which version of Node.js are you using? I think that this could be a combination of two issues:
- Your machine doesn't have the required C++ compiler (version) to build the
uws
module as part of the regular installation process. Installing or upgrading your C++ compiler version should fix the issue. - The version of
socketcluster-client
(^5.3.1
) that is used doesn't have the pre-built binaries foruws
for that specific Node.js version - New versions ofsocketcluster-client
have the latestuws
binaries so bumping up thesocketcluster-client
dependency should fix the issue.
@jondubois Thanks for the quick reply!
I'm running Node 9.2, Windows 8.1, have Visual C++ 2015, just installed GCC, socketcluster-client ^9.0.0, and uws to no avail. I can't even use the remotedev command by itself, I just get get the C++ compile error.
@SSTPIERRE2 It's likely related to the uws
dependency on Windows specifically. I found this comment that may help (make sure you have all these tools installed): https://github.com/nodejs/node-gyp/issues/1056#issuecomment-285131148
I'm on Linux so it's hard for me to test.
Hmm I still see the same uwebsockets compile error =/
Hey guys.. I guess i'm a little late here, but just in case people have the same problem in the future. I was having the same problem and I found out that my computer's clock was not in sync with the Android's clock. So to fix it, I just had to set the time of the computer and the Android exactly the same (even the seconds).
@Dias999
Hey guys.. I guess i'm a little late here, but just in case people have the same problem in the future. I was having the same problem and I found out that my computer's clock was not in sync with the Android's clock. So to fix it, I just had to set the time of the computer and the Android exactly the same (even the seconds).
Debugger and device times have drifted by more than 60s.
Please correct this by running adb shell "date `date +%m%d%H%M%Y.%S`" on your debugger machine.
did not fix the issue.