diff --git a/es/features/subscriber.js b/es/features/subscriber.js index c1daebf2..d5149921 100644 --- a/es/features/subscriber.js +++ b/es/features/subscriber.js @@ -133,6 +133,9 @@ export class SubScriber extends Feature { if (this.socketState === 'unconnected') { return this.connect(); } + else if (this.socketState === 'connecting') { + return this.connect(); + } else if (this.socketState === 'connected' && newEvents.length > 0) { return new Promise((resolve, reject) => { this.socket.emit('sub', newEvents, (result) => { @@ -176,4 +179,10 @@ export class SubScriber extends Feature { return this.socket.id; } } + + closeSocket() { + if (this.socket) { + this.socket.close(); + } + } } diff --git a/package.json b/package.json index 38342ea2..1c12cb39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oak-frontend-base", - "version": "5.1.0", + "version": "5.1.1", "description": "oak框架中前端与业务逻辑无关的平台部分", "author": { "name": "XuChang" @@ -23,7 +23,7 @@ "node-schedule": "^2.1.1", "oak-common-aspect": "~3.0.0", "oak-domain": "~5.0.8", - "oak-memory-tree-store": "~3.3.0", + "oak-memory-tree-store": "~3.3.1", "ol": "^7.3.0", "react-native-device-info": "^10.12.0", "react-native-localize": "^3.0.4", diff --git a/src/features/subscriber.ts b/src/features/subscriber.ts index 79a6961b..1cd796fa 100644 --- a/src/features/subscriber.ts +++ b/src/features/subscriber.ts @@ -173,6 +173,9 @@ export class SubScriber extends Feature if (this.socketState === 'unconnected') { return this.connect(); } + else if (this.socketState === 'connecting') { + return this.connect(); + } else if (this.socketState === 'connected' && newEvents.length > 0) { return new Promise( (resolve, reject) => {