feat: make Socket#join() and Socket#leave() synchronous
Depending on the adapter, Socket#join() may return:
- nothing (in-memory and Redis adapters)
- a promise (custom adapters)
Breaking change: Socket#join() and Socket#leave() do not accept a
callback argument anymore.
Before:
```js
socket.join("room1", () => {
io.to("room1").emit("hello");
});
```
After:
```
socket.join("room1");
io.to("room1").emit("hello");
// or await socket.join("room1"); for custom adapters
```
Note: the need for an asynchronous method came from the Redis adapter,
which did override the Adapter#add() method in earlier versions, but
this is not the case anymore.
Reference:
- https://github.com/socketio/socket.io/blob/2.3.0/lib/socket.js#L236-L258
- https://github.com/socketio/socket.io-adapter/blob/1.1.2/index.js#L56-L65
- https://github.com/socketio/socket.io-redis/commit/05f926e13ea2beb3635c7426b9b165d034e8a96c
Related: https://github.com/socketio/socket.io/issues/3662 D
Damien Arrachequesne committed
129c6417bd818bc8b4e1b831644323876e627c13
Parent: 0d74f29