Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and unify access to request details #3792

Open
andrejleitner opened this issue Feb 4, 2021 · 3 comments
Open

Cleanup and unify access to request details #3792

andrejleitner opened this issue Feb 4, 2021 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@andrejleitner
Copy link

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

@andrejleitner andrejleitner added the bug Something isn't working label Feb 4, 2021
@darrachequesne
Copy link
Member

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?

@darrachequesne darrachequesne added enhancement New feature or request and removed bug Something isn't working labels Feb 4, 2021
@darrachequesne darrachequesne added this to the 4.0.0 milestone Feb 4, 2021
@andrejleitner
Copy link
Author

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.

@andrejleitner
Copy link
Author

5.0.0?

@darrachequesne darrachequesne modified the milestones: 4.0.0, 5.0.0 Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants