forked from socketio/socket.io-redis-adapter
-
Notifications
You must be signed in to change notification settings - Fork 1
merge from master #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tal-beja
wants to merge
115
commits into
tal-beja:master
Choose a base branch
from
socketio:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add license info
#146) This PR refactors the way requests are sent between nodes. The `subJson` client has been removed, the subClient now listens to three channels by default: - the usual channel, where the message are broadcast - the request channel, where any node can request information (for now, the clients in a given rooms or the rooms for a given client) - the response channel, where a node will receive answer to its requests
This was causing a timeout error on `.clients` as `request.numsub` was a string.
With that subscription event the `return_buffers` flag is not needed anymore.
Emitting messages with external processes trigger errors on msgpack decoding of UInt64: "TypeError: Object #<Object> has no method 'readUInt64BE'".
Remove some unused variable, and use cached functions when possible.
The following methods are implemented: - allRooms: Returns the list of all rooms. - remoteJoin: Makes the socket with the given id join the room. - remoteLeave: Makes the socket with the given id leave the room. - customRequest: Sends a request to every nodes, that will respond through the customHook method.
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
BREAKING CHANGE: the library will no longer create Redis clients on
behalf of the user.
Before:
```js
io.adapter(redisAdapter({ host: "localhost", port: 6379 }));
```
After:
```js
const pubClient = createClient({ host: "localhost", port: 6379 });
const subClient = pubClient.duplicate();
io.adapter(redisAdapter(pubClient, subClient));
```
Related:
- #314
- #374
This new API replaces the customRequest/customHook methods that were
removed in v6.
Syntax:
```js
// server A
io.serverSideEmit("hello", "world");
// server B
io.on("hello", (arg) => {
console.log(arg); // prints "world"
});
```
With acknowledgements:
```js
// server A
io.serverSideEmit("hello", "world", (err, responses) => {
console.log(responses); // prints ["hi"]
});
// server B
io.on("hello", (arg, callback) => {
callback("hi");
});
```
Related: #370
Bumps [ws](https://github.com/websockets/ws) from 7.4.5 to 7.4.6. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](websockets/ws@7.4.5...7.4.6) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.20...4.17.21) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The support for numeric rooms was lost when we used a Map for the
'rooms' property, which stores the relationships between Socket IDs and
rooms ([1]).
This commit restores the ability to use numbers as rooms:
```js
socket.join(42);
io.to(42).emit("hello");
```
Note: for proper TypeScript support, we should also update the type of
Room to `string | number`
[1]: socketio/socket.io-adapter@53ed3f4
Related: #418
This field may contain circular references, which make `JSON.stringify` throw. Related: #421
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1. - [Release notes](https://github.com/chalk/ansi-regex/releases) - [Commits](chalk/ansi-regex@v5.0.0...v5.0.1) --- updated-dependencies: - dependency-name: ansi-regex dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Reference: https://github.com/redis/node-redis/blob/master/docs/v3-to-v4.md Related: - #427 - #423 - #417
Previously, a request would be sent to all listening nodes, on channel
`${key}-request#${nsp}#` (e.g. "socket.io-request#/#"), and the other
nodes would respond on a common channel `${key}-response#${nsp}#`, so
every node get the response, instead of only the requesting node.
This commit adds a new option: "publishOnSpecificResponseChannel". If
it's set to true, then the other nodes will now respond on
`${key}-response#${nsp}#${uid}#`, which is the channel specific to the
requesting node, thus reducing the noise for the other nodes.
To upgrade an existing deployment, users will need to upgrade all nodes
to the latest version with publishOnSpecificResponseChannel = false,
and then toggle the option on each node.
Note: the option will default to true in the next major release
Related: #407
Previously, the "error" events from the two Redis clients were
forwarded by each instance of the adapter, which made it quite hard to
handle the errors with a lot of namespaces (as there is one instance of
adapter per namespace).
```js
io.of("/my-namespace").adapter.on("error", () => {
// ...
});
```
The adapter instance will no longer emit "error" events, and will print
a warning if there is no other error handler registered (for backward
compatibility).
The error handling must be done directly on the Redis client:
```js
redisClient.on("error", (err) => {
// something went wrong, maybe the connection to the server was lost
});
```
Related:
- #412
- #425
The redis clients must be connected manually in v4, else it will throw: > Error: The client is closed Related: #435
It seems the clients must be connected before creating the adapter. Related: #436
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.