socketio / socketio/socket.io

Metadata for rooms

Open
#4,728 10 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Feature Request

Add metadata to rooms in the same manner that socket.data functions.

Purpose

I want to add some data related to the status/features of a room.
I'm creating rooms where one socket is the "owner" of the room, however that user might change, they might reconnect/disconnect. Logically it is better to separate that logic and apply it to the room itself rather than a socket within the room.

Concept

const rooms = io.of("/").adapter.rooms;

const myRoom = rooms.find((room) => {
   return room.data.customVariable = "myCustomValue";
});

console.log(`you've just found your specialRoom ${myRoom}`);

Would also need to be able to set data to it in the same manner we can define socket.data.whatever = {}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the adapter.rooms entry point and the socket.data API mentioned in the request. Determine how room metadata should be stored, accessed, and handled as rooms are created or removed; done means the behavior and public API are defined and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.