-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Need to connect to web socket server with cookie #495
Comments
I believe this is related to #496. |
I was able to do this by creating a MqttClientWebSocketOptions class and attaching a CookieContainer, then assigning this to ChannelOptions of a manually created MqttClientOptions class. In other words this is possible without using the builder, but it'd be nice if there was an override that included a cookie container on WithWebSocketServer() extension. |
Not sure, if cookies are passed through request headers, but while adding the option for headers, I will also add an overload for the All while leaving the default call with only the url for backwards compatibility |
I just tested this and I do get cookies back to the client from the connect call, and when I set them they are also recognized on the server. I am doing this because, in scaled Azure instances, I wish to target specific instances of my MQTT broker behind the load balancer. I can tell which instance the client is talking to by observing the ARRAffinity cookie in my cookie collection, and I can also target a specific instance to connect with by setting the cookie. It's all wonderfully awesome. |
@djarvis I've just created a pull request allowing to pass the cookies and request headers if you want to check it out |
I assume that this is done. Please re-open this issue or comment if you have any concerns, @djarvis. |
I need to connect to a websocket server with the outgoing initial HTTP request containing a cookie. Is this possible? I didn't see any options in MqttClientOptionsBuilder.
The text was updated successfully, but these errors were encountered: