mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-04 21:39:04 +00:00
create the wsServer based on webserver, no need for a seperate wsPort
This commit is contained in:
@@ -19,7 +19,6 @@ import {
|
||||
toggleRemoteGlobalProxyFlag,
|
||||
updateShouldClearRecord,
|
||||
updateIsRootCAExists,
|
||||
updateGlobalWsPort,
|
||||
showFilter,
|
||||
updateLocalAppVersion
|
||||
} from 'action/globalStatusAction';
|
||||
@@ -141,14 +140,12 @@ class HeaderMenu extends React.Component {
|
||||
ruleSummary: response.ruleSummary,
|
||||
rootCADirPath: response.rootCADirPath,
|
||||
ipAddress: response.ipAddress,
|
||||
port: response.port,
|
||||
wsPort: response.wsPort
|
||||
port: response.port
|
||||
});
|
||||
this.props.dispatch(updateLocalInterceptHttpsFlag(response.currentInterceptFlag));
|
||||
this.props.dispatch(updateLocalGlobalProxyFlag(response.currentGlobalProxyFlag));
|
||||
this.props.dispatch(updateLocalAppVersion(response.appVersion));
|
||||
this.props.dispatch(updateIsRootCAExists(response.rootCAExists));
|
||||
this.props.dispatch(updateGlobalWsPort(response.wsPort));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
@@ -66,7 +66,7 @@ class RecordDetail extends React.Component {
|
||||
|
||||
getWsMessageDiv(recordDetail) {
|
||||
const { globalStatus } = this.props;
|
||||
return <RecordWsMessageDetail recordDetail={recordDetail} wsPort={globalStatus.wsPort} />;
|
||||
return <RecordWsMessageDetail recordDetail={recordDetail} />;
|
||||
}
|
||||
|
||||
getRecordContentDiv(recordDetail = {}, fetchingRecord) {
|
||||
|
||||
@@ -49,8 +49,7 @@ class RecordWsMessageDetail extends React.Component {
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
recordDetail: PropTypes.object,
|
||||
wsPort: PropTypes.number
|
||||
recordDetail: PropTypes.object
|
||||
}
|
||||
|
||||
toggleRefresh () {
|
||||
@@ -112,13 +111,11 @@ class RecordWsMessageDetail extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
const { wsPort, recordDetail } = this.props;
|
||||
if (!wsPort) {
|
||||
return;
|
||||
}
|
||||
const { recordDetail } = this.props;
|
||||
|
||||
this.refreshPage();
|
||||
|
||||
this.wsClient = initWs(wsPort);
|
||||
this.wsClient = initWs();
|
||||
this.wsClient.addEventListener('message', this.onMessageHandler);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,12 +140,11 @@ class WsListener extends React.Component {
|
||||
}
|
||||
|
||||
initWs() {
|
||||
const { wsPort } = this.props.globalStatus;
|
||||
if (!wsPort || this.state.wsInited) {
|
||||
if (this.state.wsInited) {
|
||||
return;
|
||||
}
|
||||
this.state.wsInited = true;
|
||||
const wsClient = initWs(wsPort);
|
||||
const wsClient = initWs();
|
||||
wsClient.onmessage = this.onWsMessage;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user