Skip to content
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

How do you remoteDisconnect? #90

Closed
Bioblaze opened this issue Feb 1, 2021 · 1 comment
Closed

How do you remoteDisconnect? #90

Bioblaze opened this issue Feb 1, 2021 · 1 comment
Milestone

Comments

@Bioblaze
Copy link

Bioblaze commented Feb 1, 2021

Is there a way to Trigger a Remote Disconnect on the Servers?

darrachequesne added a commit that referenced this issue Mar 17, 2021
The codebase is now written in TypeScript.

Additional features:

- https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#Allow-excluding-specific-rooms-when-broadcasting
- https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#Additional-utility-methods
- https://socket.io/docs/v4/migrating-from-3-x-to-4-0/#Typed-events

BREAKING CHANGE: the "redis" package is not installed by default
anymore, you'll now need to create your own redis client and pass it to
the Emitter constructor

Before:

```js
const io = require("socket.io-emitter")({ host: "127.0.0.1", port: 6379 });
```

After:

```js
const { Emitter } = require("socket.io-emitter");
const { createClient } = require("redis");

const redisClient = createClient();
const io = new Emitter(redisClient);
```

Related:

- #89
- #90
- #95
@darrachequesne
Copy link
Member

Added in @socket.io/[email protected] (a70db12)

Syntax:

// make all Socket instances disconnect
io.disconnectSockets();

// make all Socket instances of the "admin" namespace in the "room1" room disconnect
io.of("/admin").in("room1").disconnectSockets();

// this also works with a single socket ID
io.of("/admin").in(theSocketId).disconnectSockets();

@darrachequesne darrachequesne added this to the 4.0.0 milestone Mar 17, 2021
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

No branches or pull requests

2 participants