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

Add websocket/http request to client object during connection #322

Merged
merged 3 commits into from
Sep 14, 2019

Conversation

abachman
Copy link
Contributor

@abachman abachman commented Sep 9, 2019

Servers based on websocket-stream require access to the original HTTP request headers in order to access the X-Forwarded-For or any other interesting HTTP header.

I've done the minimal possible work to attach the original HTTP request to aedes' Client object so that it's available later on.

@mcollina
Copy link
Collaborator

This would need docs and a test, otherwise I’m good to add this.

@abachman
Copy link
Contributor Author

Thanks for the quick attention!

I added a websocket-stream based server + client test modeled after similar tests in tests/not-blocking.js. It creates the http server, connects a client with headers, and then checks to see that the headers are present.

I also added brief notes to README.md on the conn and req properties of Client objects.

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gnought
Copy link
Collaborator

gnought commented Sep 14, 2019

LGTM

@gnought gnought merged commit 18aeb22 into moscajs:master Sep 14, 2019
@abachman abachman deleted the pass-websocket-request branch September 16, 2019 19:22
@CyanoFresh
Copy link

please make a release with this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants