-
Notifications
You must be signed in to change notification settings - Fork 269
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
feat(rumqttd): Support for websocket connections #633
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the PR 🚀 !!
I have added some comments, other than that, it looks good. But I need to try it out myself, so please give me lil time, will get back to you ASAP. ⚡
Added better control for TLS. Not the two TLS features of rumqttd configure the websocket TLS aswell. With support for both native and Rustls. |
Thank you for your patience, I did try it out using websocket example with the following change and it seemed to work let mut mqttoptions = MqttOptions::new(
"clientId-aSziq39Bp3",
"ws://localhost:8080/",
8080,
); But you mentioned this:
would like to know what do you mean by working smoothly |
That was mostly about TLS and the fact that I could not get my local MQTTX to work against it. Still a bit of a issue with the MQTTX desktop client. The web one works as expected. Will try to debug/test it a bit more later today. TLS works fine now with rumqttc 👍🏼 |
So have now tried on a different computer. MQTTX still doesn't work, getting |
Okey so an update on the MQTTX problem. It seems I forgot to read the spec for how websockets are supposed to work. |
That's awesome! GG 🚀 |
One thing to note, rumqttc currently does not validate this header. Might be something to note/look into? |
All done now. Had some branch issues but should be all good now! 👍🏼 |
Do you mean the websocket subprotocol header? Can you please open an issue with context / other details? Thank you! |
Yes exactly. Will do! |
Absolutly. Bothered me aswell though thought it might be out of scope. 👍🏼 |
@henil Changed the feature. Kept the old one but now it just points to the new feature. This will allow users using the previous feature. Might not actually be anyone though? |
yup sounds good to me, we can remove the extra feature after few releases. |
Once we announce it and people start to use it, it might just increase the number of people who will get affected when we remove that feature! |
@swanandx when we release we can explicitly mention that use |
Both are valid options. I highly doubt a lot of people are using the existing |
There is a also a commented out part of what I am pretty sure is the old shadow implementation at https://github.com/Nickztar/rumqtt/blob/340667fd74014de821d64aa372ddb8a8bf2f81a5/rumqttd/src/server/broker.rs#L285 Maybe this should be removed? |
yup, can be removed. |
this is failing to compile when using
which is weird because it can only happen when both But we are only enabling And even more weirdly this works:
we are using it here |
This is probably a problem between rumqttc and rumqttd. If you |
yeah its happening because of rumqttc using |
@Nickztar any specific reason to use |
Probably had a reason. Will look into it, otherwise I Will change it to use native. |
Okay according to https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options the correct way to specify feature for a workspace is so if you are running it from root of repo:
|
Oh interesting. Still feels weird that it fails to compile since we are specifying the binary which it should run. Could not find any interesting reason to use manual over native. Might be a reason but having them different still feels weird. Changing it back to native-certs. |
yeah i tried to find if there is already an open issue for it on cargo, but couldn't find it. |
@henil Should I be worried about checks not passing? Seems to only be for macos and feels unrelated to this change. Previous checks have passed. |
Its one of the test that fails randomly, dont worry about it |
Thank you @Nickztar for all the work 🎉! |
--------- Co-authored-by: Henil Dedania <dedaniahenil@gmail.com>
I have been trying out the broker for a short while now and one feature that seems to be missing is the websocket support. This PR is a attempt at solving that. It currently is not 100% and will try to get it working smoothly. The project did previously have a websocket implementation for which I am unsure of the purple. Those parts have been slightly changed/commented for now. The current implementation in this PR works by wrapping the websocket connection and forwarding it to the the v3.1.1 protocol. Adding support for v5 should not be difficult. Please let me know your thoughts on this and any feedback/change is welcomed.
Type of change
New feature (non-breaking change which adds functionality)
Checklist:
cargo fmt
CHANGELOG.md
if its relevant of user of the library. If its not relevant mention why.