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

Set custom headers on WSS connection #22

Closed
mmcArg opened this issue Jul 25, 2019 · 7 comments
Closed

Set custom headers on WSS connection #22

mmcArg opened this issue Jul 25, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@mmcArg
Copy link

mmcArg commented Jul 25, 2019

Hi!!!, first of all, the library is great!!!!, and sorry for my english.
I am working with a server that requires a token in connection header ("Authorization: JWT [token]") to accept the connection of websocket. Is possible to add a custom header in header request?

@gilmaimon
Copy link
Owner

Hi, thanks! I'm glad you like the library and find it useful.

It's not possible at the moment, but it won't be very difficult to add. Give me 24 hours (max) and it will be ready!

Best regards,
Gil.

@gilmaimon gilmaimon added the enhancement New feature or request label Jul 25, 2019
@gilmaimon gilmaimon self-assigned this Jul 25, 2019
@mmcArg
Copy link
Author

mmcArg commented Jul 25, 2019

24hs max!!!!! you are my idol !!!!!! Thanks!!!!!

gilmaimon added a commit that referenced this issue Jul 25, 2019
gilmaimon added a commit that referenced this issue Jul 25, 2019
Added addHeader method to WebsocketsClient as suggested in issue #22
@gilmaimon
Copy link
Owner

gilmaimon commented Jul 25, 2019

How about 4 hours max 😃

Thanks for the kind words, Iv'e added an addHeader method to WebsocketsClient. Just make sure you call it before you call connect.

Example:

client.addHeader("Authorization", "JWT [token]");

Wait for version 0.4.8 (it will be in the IDE soon, you can also get it as ZIP).

Thanks again for using the library, give it a star if you liked it so more users can notice it. Let me know that you have used the new version and that everything works fine for you.

Have an awesome weekend,
Gil.

@mmcArg
Copy link
Author

mmcArg commented Jul 29, 2019

Hi Gil, thanks for your time. For some reason do not work. I have another example made with another library (Links2004), and works ok, but with your example Y can not obtain the websocket. I will make furter test to find the diference and tell you. Regards!!!!

@gilmaimon
Copy link
Owner

That's odd. Can you show me your code?

@adelin-mcbsoft
Copy link
Contributor

adelin-mcbsoft commented Aug 2, 2019

Hey Gil (@gilmaimon), cool new feature, I was also looking for this!
I confirm it works (tested with v0.4.9).
(...and man, you are fast! 😄 ).

@mmcArg - make sure you're not behind a proxy server which does not forward the headers; may be the case. And also, this must be called BEFORE client.connect() .

Keep up the good work,
Many thanks Gil,

Best,
A.

@gilmaimon
Copy link
Owner

gilmaimon commented Aug 2, 2019

Hey Gil (@gilmaimon), cool new feature, I was also looking for this!
I confirm it works (tested with v0.4.9).
(...and man, you are fast! 😄 ).

@mmcArg - make sure you're not behind a proxy server which does not forward the headers; may be the case. And also, this must be called BEFORE client.connect() .

Keep up the good work,
Many thanks Gil,

Best,
A.

Awesome as always. Thanks Adelin!

Gil.

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

3 participants