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

Append new headers to the client when reconnecting #865

Closed
cyyynthia opened this issue Mar 6, 2019 · 6 comments
Closed

Append new headers to the client when reconnecting #865

cyyynthia opened this issue Mar 6, 2019 · 6 comments

Comments

@cyyynthia
Copy link

Is your feature request related to a problem? Please describe.
I'm developing a client for an app that accepts a Resume-Id header when reconnecting for resuming a session. For now it looks like it's impossible to alter the list of headers which is a requirement for that kind of stuff

Describe the solution you'd like
Allow headers to be added, maybe only when socket is not connected.

Describe alternatives you've considered
It can be a .addHeader function, or a hook "onBeforeConnect" to add headers there

@haruntuncay
Copy link
Collaborator

haruntuncay commented Mar 9, 2019

If this is planned as a new-feature or as an enhancement, I would like to help.

@marci4
Copy link
Collaborator

marci4 commented Mar 11, 2019

Maybe simple adding a setter would be enough?

@haruntuncay
Copy link
Collaborator

We could add a method to put additional headers and it could initialize private Map<String,String> headers; variable, if not initialized yet, and then just add the value. The values in the headers map would automatically be used with each call to connect() and reconnect().

I also added a method to remove a header since a user may not want to send every header on every call to reconnect().
Btw, I actually have a commit ready for this, but I don't want that commit to go in to the pending PR, since that PR covers something entirely unrelated. I will send a new PR for this issue once the pending one is merged/closed.

@NoahAndrews
Copy link
Contributor

@haruntuncay You can submit multiple PRs at once, you just need to submit them from different branches. In general it's a good idea to work on code in feature branches, rather than your master branch like you did with the currently open PR.

@haruntuncay
Copy link
Collaborator

@haruntuncay You can submit multiple PRs at once, you just need to submit them from different branches. In general it's a good idea to work on code in feature branches, rather than your master branch like you did with the currently open PR.

Thank you for the notice. I wasn't aware that we could submit multiple PRs simultaneously.

marci4 added a commit that referenced this issue Apr 8, 2019
Add a way to put additional headers to handshake for connecting/reconnecting, see #865
@marci4
Copy link
Collaborator

marci4 commented Apr 8, 2019

Resolved #868

@marci4 marci4 closed this as completed Apr 8, 2019
@marci4 marci4 added this to the Release 1.4.1 milestone Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants