Commit Graph

6 Commits

Author SHA1 Message Date
Sebastiaan Marynissen
985bb41fa2 feat: allow excluding all sockets in a room (#66) 2021-02-26 15:32:45 +01:00
Damien Arrachequesne
155fa6333a feat: add room events
The adapter will now emit the following events:

- create-room (arg: room)
- delete-room (arg: room)
- join-room (args: room, sid)
- leave-room (args: room, sid)

Related: https://github.com/socketio/socket.io/issues/2897
2021-01-15 01:22:49 +01:00
Damien Arrachequesne
0a9762cac2 refactor: use Namespace#sockets to broadcast 2020-10-15 12:15:32 +02:00
Damien Arrachequesne
b52b4ef49e refactor: migrate to TypeScript 2020-09-25 23:01:42 +02:00
Damien Arrachequesne
130f28a43c refactor: rename clients and clientRooms methods
In Socket.IO glossary:

- a Client manages the low-level connection and can be associated with several Sockets
- a Socket belongs to a given Namespace
2020-09-16 22:27:27 +02:00
Damien Arrachequesne
53ed3f4099 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).
2020-09-16 22:19:56 +02:00