问题
I cannot connect remote-redux-devtools debugger in chrome and getting this error:
SocketProtocolError {
name: "SocketProtocolError",
message: "Socket hung up",
code: 1006,
stack: "SocketProtocolError: Socket hung up
at SCSocke…e?platform=android&dev=true&minify=false:2648:44)"
}
my code is the following:
import thunk from 'redux-thunk';
import {persistReducer, persistStore} from 'redux-persist';
import {composeWithDevTools} from 'remote-redux-devtools';
import * as actions from './actions';
import rootReducer from './reducers';
import {REMEMBER_LIST} from '../constants';
const persistConfig = {
key: 'root',
storage: AsyncStorage,
whitelist: REMEMBER_LIST,
};
const persistedReducer = persistReducer(persistConfig, rootReducer);
const composeEnhancers = composeWithDevTools({realtime: true});
const store = createStore(
persistedReducer,
composeEnhancers(applyMiddleware(thunk)),
);
回答1:
I found the solution, it's need to use remotedev-server. As in document it's not recommend to use remotedev-sever golbally, but I get an error with using as dev dependency so I use globally. the instruction is:
- install the
remotedev-serverglobally - run
remotedev --port=8000 - open browser and go to
localhost:8000/socketcluster/( it's still getting error if it's not include/socketcluster/alias. - you have to add specific port number and computer's IP as following:
const composeEnhancers = composeWithDevTools({
realtime: true,
port: 8000,
hostname: '192.168.1.106', //add your computer's IP
});
来源:https://stackoverflow.com/questions/59946194/cannot-connect-remote-redux-devtools-in-react-native