@ives_xxz/framework 1.2.14 → 1.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/service/socket/FWSocket.ts +10 -3
package/package.json
CHANGED
|
@@ -74,9 +74,9 @@ export default class FWSocket implements FW.Socket {
|
|
|
74
74
|
this.tag = tag;
|
|
75
75
|
this.address = address;
|
|
76
76
|
|
|
77
|
+
this.clear();
|
|
78
|
+
|
|
77
79
|
this.messageEvents = {};
|
|
78
|
-
this.protocolContainer.clear();
|
|
79
|
-
this.protocolRegistry.clear();
|
|
80
80
|
this.sendHeartTimestamp = 0;
|
|
81
81
|
this.receiveTimeStamp = new Date().getTime();
|
|
82
82
|
|
|
@@ -149,7 +149,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
149
149
|
* 关闭连接
|
|
150
150
|
*/
|
|
151
151
|
public close() {
|
|
152
|
-
this.
|
|
152
|
+
this.clear();
|
|
153
153
|
FW.Entry.socketMgr.closeSocket(this);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -165,6 +165,11 @@ export default class FWSocket implements FW.Socket {
|
|
|
165
165
|
return this.getReadyState() === WebSocket.CONNECTING;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
public clear() {
|
|
169
|
+
this.protocolContainer.clear();
|
|
170
|
+
this.protocolRegistry.clear();
|
|
171
|
+
}
|
|
172
|
+
|
|
168
173
|
reconnect(force?: boolean) {
|
|
169
174
|
if (force) this.reconnectTimes = 0;
|
|
170
175
|
|
|
@@ -175,6 +180,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
175
180
|
this.handle?.onTimeout?.();
|
|
176
181
|
return;
|
|
177
182
|
}
|
|
183
|
+
this.clear();
|
|
178
184
|
|
|
179
185
|
this.socket?.close();
|
|
180
186
|
this.socket = null;
|
|
@@ -270,6 +276,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
270
276
|
this,
|
|
271
277
|
);
|
|
272
278
|
}
|
|
279
|
+
|
|
273
280
|
/** 消息处理 */
|
|
274
281
|
private async onSocketMessage(originalMsg: any) {
|
|
275
282
|
const msg = await this.handle.onBeforeReceivingMessage(originalMsg);
|