Skip to content

fix: [Issues: #4] httpBridge.stop()方法调用导致服务器无法重新连接问题处理 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified harmony/http_bridge.har
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class RNHttpBridgeTurboModule extends TurboModule implements TM.ReactNati

private stopServer() {
if (this.server != null) {
this.server.stop();
this.server = null;
this.port = 0;
}
Expand Down
6 changes: 1 addition & 5 deletions harmony/http_bridge/src/main/ets/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class Server {
this.context.rnInstance.emitDeviceEvent(SERVER_EVENT_ID, result);

emitter.once('requestId' + this.requestId, (data) => {
Logger.info(TAG, 'on EventEmitter data: ' + JSON.stringify(data.data))
Logger.info(TAG, 'on EventEmitter data: ' + JSON.stringify(data.data));
if (this.requestId === data.data.requestId) {
res.writeHead(data.data.code, {
'Content-Type': data.data.type,
Expand All @@ -96,8 +96,4 @@ export class Server {
};
emitter.emit('requestId' + requestId, eventData);
}

stop() {
this.polkaServer.server?.stop();
}
}