[Feature] Live socket events for clients signed in with a client token (device pairing)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- api, authentication, backend, networking
Research direction
Start by reading endpoints/sockets/logs.py and comparing the main and netplay namespace connection handlers with the /devices namespace’s client-token handling. Trace /api/auth/device/init and /token, then identify where users join user:<id> rooms and where emit_to_user targets them. Done means paired clients can authenticate to the relevant sockets, receive their permitted live events, and open netplay rooms, with appropriate scope and revocation checks.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Clients that sign in through device pairing (/api/auth/device/init + /token) get a client token, which works for the whole REST API. But the main Socket.IO namespace (/) only recognises the web session cookie (endpoints/sockets/logs.py connect reads the session from the environ), so a paired client never joins user:<id> and never receives notifications:new, activity:update or any other per-user event. The same goes for the netplay namespace: a socket without the web session has no user, so it can join a room with its password but cannot open one.
The result is that a TV or handheld client signed in the recommended way has to poll for everything, and features built on notifications (5.5) only work on clients that also hold a web session.
Describe the solution you'd like
The /devices namespace already does the hard part: it accepts a device-bound client token (handshake auth.token or Authorization: Bearer), checks it, tracks the socket for revocation and closes it on expiry. Either of these would close the gap:
- on
/devicesconnect, also enter a per-user room for the token's owner in that namespace, and haveemit_to_useremit there too (so notifications and activity reach paired devices), or - accept a client token on
/(and on the netplay namespace) the same way, resolving the user and joininguser:<id>, with a scope check (for examplenotifications.readfor notifications,me.readto connect at all).
Describe alternatives you've considered
Polling GET /api/notifications and GET /api/activity every 10-40 s, and asking users to also sign in on the web page inside the app just to get a cookie for the socket. In Arcade TV (an Android TV client for RomM) a TV signed in with a code can't open a netplay room and gets no live updates, so it shows a "Turn on messages and parties" prompt that sends the user to the web sign-in.
Additional context
Mentioned briefly in a comment on #5831. Device presence (device_presence:<id>, 90 s TTL) would also become meaningful for these clients once they hold a socket.
- Dominant language
- Python
- Stars
- 13.3k
- Forks
- 747
- Avg merge
- 20h 58m
- Merged PRs (30d)
- 207
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rommapp/romm
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rommapp/romm#5857 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rommapp/romm#4178 · 1 reaction ·
Maintainers usually reply within 1 day
-
[UI/UX] Misaligned number in searchPossibly taken @NevesHenry claimed this today. Openui/ux
Difficulty 2/5 1-3 hours Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
[Bug] Games do not show up in search if more than 2 letters are used.Possibly taken @andest01 claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
rommapp/romm#5853 · 7 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
web-push-libs/pywebpush#216 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AgriciDaniel/claude-seo#572 ·
Maintainers usually reply within 5 days
-
area:print-dispatch
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
area: docs domain: technical-writing good first issue type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Deepak3699/Ai_Mentor#919 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day