Skip to content

Commit

Permalink
fix: [Issues: #4] httpBridge.stop()方法调用导致服务器无法重新连接问题处理 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
wh-hujinyun authored Jul 23, 2024
1 parent 9112390 commit 27b5641
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
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();
}
}

0 comments on commit 27b5641

Please sign in to comment.