socket.io
socket.io copied to clipboard
Cleanup and unify access to request details
There are socket.request.headers, socket.conn.request.headers and socket.handshake.headers all referencing the same thing, so this is just a suggestion for a clearer interface around request data.
Socket.IO server version: 3.1.0
https://github.com/socketio/socket.io/blob/3.1.0/lib/socket.ts#L126 https://github.com/socketio/socket.io/blob/3.1.0/lib/socket.ts#L587-L589 https://github.com/socketio/socket.io/blob/3.1.0/lib/socket.ts#L596-L598
I think the official way is the handshake object: socket.handshake.headers.
We can indeed remove the other references (which were added a long time ago), but that will be a breaking change. We could schedule it for v4, what do you think?
To decide what is the official way is probably up to you, I just vote for cleaner interface. One way instead of three seems better to me ... also for users to understand. The next major version makes sense.
5.0.0?