@dnax/core 0.16.3 → 0.16.4
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/lib/socket/instance.ts +4 -2
- package/package.json +1 -1
package/lib/socket/instance.ts
CHANGED
|
@@ -75,9 +75,9 @@ function webSocketServer(server: Server): WebSocketHandler {
|
|
|
75
75
|
let id = v4();
|
|
76
76
|
ws.id = id;
|
|
77
77
|
wsClients.set(id, ws);
|
|
78
|
+
|
|
78
79
|
// set Id to client and emit it
|
|
79
80
|
ws.send(JSON.stringify({ type: "setId", id: id }));
|
|
80
|
-
|
|
81
81
|
// run all listenners event for connection
|
|
82
82
|
let evs = wsEvents.filter(
|
|
83
83
|
(e) => e.type == "on" && e?.event == "connection"
|
|
@@ -113,13 +113,15 @@ function webSocketServer(server: Server): WebSocketHandler {
|
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
+
|
|
117
|
+
wsClients?.delete(ws.id);
|
|
116
118
|
// console.log("close", code, reason);
|
|
117
119
|
// console.log(ws.id);
|
|
118
120
|
},
|
|
119
121
|
message: (ws, message: any) => {
|
|
120
122
|
try {
|
|
121
123
|
let options: optionsIo = JSON.parse(message);
|
|
122
|
-
|
|
124
|
+
|
|
123
125
|
// find all listeners : On
|
|
124
126
|
let evs = wsEvents.filter(
|
|
125
127
|
(e) => e.event == options?.event && e?.type == "on"
|