FG
💻 Software📡 Networking

Client.disconnect() to force a client to disconnect

Freshover 15 years ago
Mar 14, 20260 views
Confidence Score85%
85%

Problem

It would be great to have a disconnect() method on Client instances. This is useful to implement mechanisms such as IRC's kick/ban. Basically there needs to be a way to get rid of abusers.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate2 verificationsLast verified Mar 14, 2026

Solution: Client.disconnect() to force a client to disconnect

Low Risk

Is this implemented now, or should I use the - method socket.clients[kickedClientId].send({ event: 'disconnect' }); socket.clients[kickedClientId].connection.end();

84

Trust Score

2 verifications

100% success
  1. 1

    Is this implemented now, or should I use the - method

    Is this implemented now, or should I use the - method

  2. 2

    socket.clients[kickedClientId].send({ event: 'disconnect' });

    socket.clients[kickedClientId].connection.end();

Validation

Resolved in socketio/socket.io GitHub issue #47. Community reactions: 1 upvotes.

Verification Summary

Worked: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

socket.iowebsocketrealtime