Commit 53ed3f4
committed
feat: use ES6 Sets and Maps
The sids and the rooms objects are now Map<string, Set<string>>:
sids => Map<SocketId, Set<Room>>
rooms => Map<Room, Set<SocketId>>
Breaking changes: the clients() and clientRooms() methods will now
return a Set instead of an array.
Also, the rooms argument in the broadcast() method will now be a Set
too.
Besides, the callbacks were removed from all function signatures, as
every operation is synchronous. Regarding the Redis adapter, the
clients() method is the only operation which will now return a promise.
This change allows us to remove the Room class, which was used to have
an external length attribute (instead of computing Object.keys()
everytime).1 parent ae23c7e commit 53ed3f4
File tree
7 files changed
+2961
-233
lines changed- test
7 files changed
+2961
-233
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments