stelar-time-real 1.0.1 → 1.0.3
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/README.md +19 -4
- package/package.json +6 -2
- package/src/index.js +4 -2
package/README.md
CHANGED
|
@@ -22,11 +22,17 @@ npm install stelar-time-real
|
|
|
22
22
|
|
|
23
23
|
## Inicio Rápido
|
|
24
24
|
|
|
25
|
+
### Un solo import para todo
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
import StelarServer, { StelarClient } from 'stelar-time-real';
|
|
29
|
+
```
|
|
30
|
+
|
|
25
31
|
### Servidor
|
|
26
32
|
|
|
27
33
|
```javascript
|
|
28
34
|
import express from 'express';
|
|
29
|
-
import StelarServer from 'stelar-time-real';
|
|
35
|
+
import { StelarServer } from 'stelar-time-real';
|
|
30
36
|
|
|
31
37
|
const app = express();
|
|
32
38
|
const server = app.listen(3000);
|
|
@@ -48,7 +54,7 @@ stelar.start();
|
|
|
48
54
|
### Cliente
|
|
49
55
|
|
|
50
56
|
```javascript
|
|
51
|
-
import StelarClient from 'stelar-time-real
|
|
57
|
+
import { StelarClient } from 'stelar-time-real';
|
|
52
58
|
|
|
53
59
|
const client = new StelarClient('localhost:3000');
|
|
54
60
|
|
|
@@ -320,7 +326,7 @@ client.on('error', (err) => {}); // Cuando hay error
|
|
|
320
326
|
**server.js**
|
|
321
327
|
```javascript
|
|
322
328
|
import express from 'express';
|
|
323
|
-
import StelarServer from 'stelar-time-real';
|
|
329
|
+
import { StelarServer } from 'stelar-time-real';
|
|
324
330
|
|
|
325
331
|
const app = express();
|
|
326
332
|
const server = app.listen(3000);
|
|
@@ -342,7 +348,7 @@ console.log('Chat en http://localhost:3000');
|
|
|
342
348
|
**cliente.html**
|
|
343
349
|
```html
|
|
344
350
|
<script type="module">
|
|
345
|
-
import StelarClient from 'stelar-time-real
|
|
351
|
+
import { StelarClient } from 'stelar-time-real';
|
|
346
352
|
|
|
347
353
|
const client = new StelarClient(3000);
|
|
348
354
|
|
|
@@ -393,6 +399,8 @@ stelar.use((ctx, next) => {
|
|
|
393
399
|
### Con Reconexión Automática
|
|
394
400
|
|
|
395
401
|
```javascript
|
|
402
|
+
import { StelarClient } from 'stelar-time-real';
|
|
403
|
+
|
|
396
404
|
const client = new StelarClient('localhost:3000', {
|
|
397
405
|
reconnection: true,
|
|
398
406
|
reconnectionAttempts: 5,
|
|
@@ -420,6 +428,13 @@ client.connect();
|
|
|
420
428
|
|
|
421
429
|
## Changelog
|
|
422
430
|
|
|
431
|
+
### v1.0.3
|
|
432
|
+
- Exportación mejorada: un solo import para servidor y cliente
|
|
433
|
+
- `import { StelarServer, StelarClient } from 'stelar-time-real'`
|
|
434
|
+
|
|
435
|
+
### v1.0.2
|
|
436
|
+
- Exportación mejorada: un solo import para servidor y cliente
|
|
437
|
+
|
|
423
438
|
### v1.0.0
|
|
424
439
|
- Lanzamiento inicial
|
|
425
440
|
- WebSockets con ws
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stelar-time-real",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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
|
@@ -180,7 +180,7 @@ class StelarServer {
|
|
|
180
180
|
this.wss = new WebSocketServer({ server: httpServer });
|
|
181
181
|
this.wss.on('connection', (client, req) => this._handleConnection(client, req));
|
|
182
182
|
this._startHeartbeat();
|
|
183
|
-
|
|
183
|
+
|
|
184
184
|
const finalPort = this.getPort();
|
|
185
185
|
if (callback) callback(finalPort);
|
|
186
186
|
resolve(finalPort);
|
|
@@ -219,5 +219,7 @@ class StelarServer {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
import StelarClient from './client.js';
|
|
223
|
+
|
|
222
224
|
export default StelarServer;
|
|
223
|
-
export { StelarServer };
|
|
225
|
+
export { StelarServer, StelarClient };
|