Readonly
dataReadonly
handshakeReadonly
idReadonly
roomsDisconnects this client.
Optional
close: booleanif true
, closes the underlying connection
self
Joins a room.
room or array of rooms
Leaves a room.
Adds a timeout in milliseconds for the next operation.
const sockets = await io.fetchSockets();
for (const socket of sockets) {
if (someCondition) {
socket.timeout(1000).emit("some-event", (err) => {
if (err) {
// the client did not acknowledge the event in the given delay
}
});
}
}
// note: if possible, using a room instead of looping over all sockets is preferable
io.timeout(1000).to(someConditionRoom).emit("some-event", (err, responses) => {
// ...
});
Expose of subset of the attributes and methods of the Socket class