Closed ColCh closed 8 years ago
I see. I'm wondering what would be best: not to show this warning at all or to have an autoReconnect
parameter (which would be true
by default).
What do you think?
Remote dev tool connects at app load, so it will display warning at each app load...
May be make a onError handler?
So, main aim was prevent any error if dev server is off (we start it on demand, not every dev session)
We use react-native and don't always debug our code with Chrome debugger (tests are enough). And in rare cases use redux dev tools.
And this code chunk (it's a bit dirty) handled it. Starting monitoring by redux action (and filter it out). After store creation try to connect to dev server. If it's running, start redux remote dev tools monitoring.
// store enhancer. may be modified by redux dev tools later
let enhancer = applyMiddleware(thunk);
/**
* Redux remote dev tools
*/
if (__DEV__) {
const reduxDevToolsOptions = {
port: 8000,
startOn: `##REDUXDEVTOOL_START`,
realtime: false,
filters: { blacklist: [`##REDUXDEVTOOL_START`, ], }
};
const reduxDevTools = devTools(reduxDevToolsOptions);
enhancer = compose(enhancer, reduxDevTools);
}
// initialize store here...
/**
* Workaround for redux dev tools, it sends error if can't reach dev server
* Let's not it start otherwise!
*/
if (__DEV__) {
var ws = new WebSocket('ws://localhost:8000/socketcluster/');
ws.onopen = () => {
store.dispatch({ type: `##REDUXDEVTOOL_START`, });
ws.close();
ws = null;
};
setTimeout(() => {
if (ws) {
ws.close();
ws = null;
}
}, 3 * 1e3);
}
I have solved my trouble, and it was not really related to remote-redux-devtools.
I think no actions needed for this case, so @zalmoxisus, I'm closing issue now.
It just repeats forever
From this code chunk https://github.com/zalmoxisus/remote-redux-devtools/blob/22efa3b9a5711f6fe814103fa7e1465770d02191/src/devTools.js#L197...L199
May be add some config handle for socket errors?