Commit Graph

78 Commits

Author SHA1 Message Date
Damien Arrachequesne
2e023bf2b6 feat: add init() and close() methods
These extension points may be used by another adapter, in order to open
or close a connection to a database for example.

In Socket.IO v2, the join() method did accept a callback:

```js
socket.join("room1", () => {
  io.to("room1").emit("hello");
});
```

Depending on the adapter, it may now return a promise:

```js
await socket.join("room1");
io.to("room1").emit("hello");
```

Related: https://github.com/socketio/socket.io/issues/3662
2020-10-20 14:18:57 +02:00
Damien Arrachequesne
5f417d256b chore(release): 2.0.3-rc1
Diff: https://github.com/socketio/socket.io-adapter/compare/2.0.2...2.0.3-rc1
2020-10-15 12:18:09 +02:00
Damien Arrachequesne
0a9762cac2 refactor: use Namespace#sockets to broadcast 2020-10-15 12:15:32 +02:00
Damien Arrachequesne
5d81b13431 chore(release): 2.0.2
Diff: https://github.com/socketio/socket.io-adapter/compare/2.0.1...2.0.2
2020-09-28 15:32:41 +02:00
Damien Arrachequesne
e57f528944 chore(release): 2.0.1
Diff: https://github.com/socketio/socket.io-adapter/compare/2.0.0...2.0.1
2020-09-28 15:14:58 +02:00
Damien Arrachequesne
c043650f1c fix: Adapter#encode() is now synchronous
See https://github.com/socketio/socket.io-parser/releases/tag/4.0.0
2020-09-28 15:11:56 +02:00
Damien Arrachequesne
7216d7adfb chore(release): 2.0.0
Diff: https://github.com/socketio/socket.io-adapter/compare/1.1.2...2.0.0
2020-09-25 23:09:21 +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
Damien Arrachequesne
ae23c7ef4c [chore] release 1.1.2 2019-11-25 13:19:48 +01:00
Joway
b9074fa36f [fix] fix memory leak when leave a room after socket close (#58) 2019-11-25 13:14:47 +01:00
Darío Hereñú
f7ab50cc59 [docs] Remove duplicate word (#57) 2019-11-25 13:13:53 +01:00
Damien Arrachequesne
6874ea4952 [chore] release 1.1.1 2017-08-02 14:01:58 +02:00
Sam Roberts
bdb015a6c1 [chore] remove unused 'debug' dependency (#52) 2017-08-02 13:51:58 +02:00
Damien Arrachequesne
c6f7baec3b [chore] Release 1.1.0 (#50) 2017-02-26 08:38:04 +01:00
Damien Arrachequesne
f627cd2db1 [feat] Add addAll method (#49)
That will allow to efficiently join a list of rooms.
2017-02-26 08:22:54 +01:00
Damien Arrachequesne
b983377969 [chore] Release 1.0.0 (#48) 2017-02-16 22:26:40 +01:00
Damien Arrachequesne
40764bb806 [feat] Remove the socket.io-parser dependency (#47)
That will allow to use a custom parser (see https://github.com/socketio/socket.io/pull/2829).
2017-02-16 22:16:21 +01:00
Gatsbill
fd086d757e [refactor] Remove useless self var (#45) 2017-02-16 13:36:19 +01:00
Damien Arrachequesne
9a621ec592 [chore] Release 0.5.0 (#44) 2016-11-20 01:57:13 +01:00
Damien Arrachequesne
ffadfa600f [feature] Add clientRooms method (#41)
That method returns the list of rooms a given socket has joined. It is
intended to be used by other adapters, without them needing to access
the innards of the adapter.
2016-11-20 01:52:21 +01:00
Damien Arrachequesne
915af31c2c [chore] Bump debug to version 2.3.3 (#42) 2016-11-20 01:51:03 +01:00
Damien Arrachequesne
35987a5c0f [chore] Bump socket.io-parser to version 2.3.1 (#43) 2016-11-20 01:48:52 +01:00
tatellos
97bdbab37c [docs] Fix typo in Readme.md (#37) 2016-10-18 03:58:00 +02:00
Guillermo Rauch
efd6141dbd Release 0.4.0 2015-12-03 10:12:35 -08:00
Guillermo Rauch
d16e46df36 Merge pull request #30 from manubb/master-patched
Use a Room class to efficiently track room size.
2015-12-03 09:41:32 -08:00
Guillermo Rauch
6e0ecb4d3a package: bump debug 2015-11-19 09:44:13 -08:00
Manuel Baclet
bac5b0ec32 Simplify and clarify. 2015-06-11 11:37:24 +02:00
Manuel Baclet
55274af45a Small fix. 2015-06-11 11:36:06 +02:00
Manuel Baclet
1a5b6d4485 Comments on Room methods. 2015-06-11 10:58:40 +02:00
Manuel Baclet
f7e7c07fae Remove some spaces. 2015-06-11 10:58:20 +02:00
Manuel Baclet
89bd58129d Merge pull request #1 from kapouer/patch-1
Add missing closing curly brace
2015-06-11 10:37:30 +02:00
Jérémy Lal
930741ffa5 Add missing closing curly brace 2015-06-11 01:01:49 +02:00
Manuel Baclet
8e5bae4ad9 Add a newline at end of file. 2015-06-03 10:49:09 +02:00
Manuel Baclet
5c79d6ec27 Use a Room class to efficiently track room size. 2015-06-03 10:36:27 +02:00
Guillermo Rauch
de5cba46ce Merge pull request #26 from nkzawa/patch-0
Fix to apply volatile and compress flags when bloadcasting
2015-04-05 15:52:02 -07:00
Guillermo Rauch
4a1a66ac70 Merge pull request #27 from mikaturunen/patch-1
Update package.json license
2015-04-05 15:50:32 -07:00
Guillermo Rauch
ce4048d9cf Merge pull request #28 from nevir/patch-1
Add a LICENSE file
2015-04-05 15:50:24 -07:00
Ian MacLeod
53073e6a8c Add a LICENSE file
To appease the lawyery folk
2015-04-02 14:55:54 -07:00
Mika Turunen
17a2097f6d Update package.json license 2015-03-20 11:33:00 +02:00
Naoyuki Kanezawa
bd48c2f292 set flags as an option object 2015-02-15 03:08:45 +09:00
Guillermo Rauch
ae79d87274 allow clients(fn) 2015-01-31 08:41:21 -08:00
Guillermo Rauch
cb6e0d8b45 Merge pull request #24 from cha0s/clients
Suggestion for implementation of clients API
2015-01-31 08:40:16 -08:00
Ruben Rodriguez II
cba037ffa2 Suggestion for implementation of clients API 2015-01-25 18:59:07 -06:00
Guillermo Rauch
304a93d68f Merge pull request #21 from marcooliveira/master
Fix confusing comment in `add`
2015-01-17 12:28:41 +00:00
Guillermo Rauch
ddf8e61cd6 Merge pull request #20 from marcooliveira/patch-1
Call the callback on `delAll`
2015-01-17 12:27:47 +00:00
Marco Oliveira
73a1ae89de Fix confusing comment in add 2014-11-01 15:05:52 +00:00
Marco Oliveira
29d2e46900 Call the callback on delAll 2014-11-01 14:52:27 +00:00
Guillermo Rauch
e66ea47c80 Merge pull request #19 from rase-/remove/keys-dependency
Remove unnecessary dependency
2014-10-27 19:15:16 -07:00