Skip to content

Conversation

@tal-beja
Copy link
Owner

No description provided.

julianlam and others added 30 commits July 6, 2016 10:54
That new flag will prevent the adapter (redis) from publishing the emit
to the pub/sub server.
#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.
darrachequesne and others added 30 commits March 12, 2021 23:44
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>
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.