stelar-time-real 1.2.0 → 1.2.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/README.md +3 -0
- package/package.json +2 -2
- package/src/client.js +7 -32
package/README.md
CHANGED
|
@@ -558,6 +558,9 @@ client.emitBinary('upload', fileData);
|
|
|
558
558
|
|
|
559
559
|
## Changelog
|
|
560
560
|
|
|
561
|
+
### v1.2.2
|
|
562
|
+
- Bugfix: métodos duplicados en client.js
|
|
563
|
+
|
|
561
564
|
### v1.2.0
|
|
562
565
|
- Soporte binarios: envía imágenes, archivos, audio, video sin base64
|
|
563
566
|
- `ctx.emitBinary('event', buffer)` y `client.emitBinary('event', buffer)`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stelar-time-real",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "WebSocket liviano y rápido sin dependecias. Alternativa a socket.io, namespaces, ACKs y archivos binarios.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [
|
package/src/client.js
CHANGED
|
@@ -37,6 +37,13 @@ class StelarClient {
|
|
|
37
37
|
return this;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
off(event, handler) {
|
|
41
|
+
if (this.events[event] === handler) {
|
|
42
|
+
delete this.events[event];
|
|
43
|
+
}
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
onAll(handler) {
|
|
41
48
|
this._wildcardHandler = handler;
|
|
42
49
|
return this;
|
|
@@ -106,38 +113,6 @@ class StelarClient {
|
|
|
106
113
|
return this;
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
setUrl(url) {
|
|
110
|
-
this.url = url;
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
on(event, handler) {
|
|
115
|
-
this.events[event] = handler;
|
|
116
|
-
return this;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
onAll(handler) {
|
|
120
|
-
this._wildcardHandler = handler;
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
emit(event, data) {
|
|
125
|
-
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
126
|
-
this.ws.send(JSON.stringify({ event, data }));
|
|
127
|
-
}
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
joinRoom(room) {
|
|
132
|
-
this.emit('join-room', room);
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
leaveRoom() {
|
|
137
|
-
this.emit('leave-room', {});
|
|
138
|
-
return this;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
116
|
_startHeartbeat() {
|
|
142
117
|
this._hbTimer = setInterval(() => {
|
|
143
118
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|