stelar-time-real 1.0.0 → 1.0.2
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 +6 -2
- package/src/index.js +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stelar-time-real",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Tu propio sistema de tiempo real personalizado - WebSocket ligero sin dependencias",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,12 @@
|
|
|
25
25
|
"homepage": "https://github.com/stelar-time-real/stelar-time-real#readme",
|
|
26
26
|
"exports": {
|
|
27
27
|
".": "./src/index.js",
|
|
28
|
-
"./client": "./src/client.js"
|
|
28
|
+
"./client": "./src/client.js",
|
|
29
|
+
"./client.js": "./src/client.js"
|
|
29
30
|
},
|
|
31
|
+
"files": [
|
|
32
|
+
"src"
|
|
33
|
+
],
|
|
30
34
|
"dependencies": {
|
|
31
35
|
"ws": "^8.14.0"
|
|
32
36
|
}
|
package/src/index.js
CHANGED
|
@@ -159,6 +159,10 @@ class StelarServer {
|
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
client.on('close', () => {
|
|
162
|
+
const clientInfo = this.clients.get(client);
|
|
163
|
+
if (this.events['disconnect'] && clientInfo) {
|
|
164
|
+
this.events['disconnect']({ id: clientInfo.id });
|
|
165
|
+
}
|
|
162
166
|
this.clients.delete(client);
|
|
163
167
|
});
|
|
164
168
|
|
|
@@ -176,7 +180,7 @@ class StelarServer {
|
|
|
176
180
|
this.wss = new WebSocketServer({ server: httpServer });
|
|
177
181
|
this.wss.on('connection', (client, req) => this._handleConnection(client, req));
|
|
178
182
|
this._startHeartbeat();
|
|
179
|
-
|
|
183
|
+
|
|
180
184
|
const finalPort = this.getPort();
|
|
181
185
|
if (callback) callback(finalPort);
|
|
182
186
|
resolve(finalPort);
|
|
@@ -215,5 +219,7 @@ class StelarServer {
|
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
|
|
222
|
+
import StelarClient from './client.js';
|
|
223
|
+
|
|
218
224
|
export default StelarServer;
|
|
219
|
-
export { StelarServer };
|
|
225
|
+
export { StelarServer, StelarClient };
|