You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing reference (and types) for response.socket.server #47148
There seems to have been a missing property in the API reference (and @types/node typings) regarding the server property of a ServerResponse instance.
I have seen about it multiple times in articles or videos, for example to set up Socket.io in Next.js or a WebSocket module in Nuxt.
Here is a simple snippet that allows to access the server property:
const{ createServer }=require('http');createServer((req,res)=>{console.log(res.socket.server);// Logs the server instance});
I don't know if that property is supposed not to be used or if it is just missing from the API references, but it seems like the common way to 'plug in' WebSocket servers onto frameworks that don't directly provide a way to do so.
Documentation pull request welcome. It should go in doc/api/net.md
There is no real reason for the property's existence. I think Ryan added it as a "could be useful" thing back when node was being ported to Windows (the libev -> libuv switch back in 2011.)
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
Activity
ydv-ankit commentedon Mar 22, 2023
hey i wanna work on this issue
can you give more context on this
bnoordhuis commentedon Apr 5, 2023
Documentation pull request welcome. It should go in doc/api/net.md
There is no real reason for the property's existence. I think Ryan added it as a "could be useful" thing back when node was being ported to Windows (the libev -> libuv switch back in 2011.)
tapplav0 commentedon Apr 5, 2023
Is the property available on all platforms or is it only on Windows?
bnoordhuis commentedon Apr 6, 2023
All platforms.
github-actions commentedon Jun 14, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.