Skip to content

Commit

Permalink
feat: use ES6 Sets and Maps
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
darrachequesne committed Sep 16, 2020
1 parent ae23c7e commit 53ed3f4
Show file tree
Hide file tree
Showing 7 changed files with 2,961 additions and 233 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "prettier",
"parser": "babel-eslint"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.nyc_output/
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sudo: false
language: node_js
node_js:
- "10"
- "12"
- "14"
git:
depth: 1
notifications:
irc: "irc.freenode.org#socket.io"
Loading

0 comments on commit 53ed3f4

Please sign in to comment.