Skip to content

Add support for custom WebSocket path #607

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

Merged
merged 2 commits into from
Jun 6, 2025
Merged

Conversation

racknoris
Copy link

Add support for custom WebSocket path via optional websocketPath property.
Allows connecting to brokers that serve MQTT over WebSocket on non-root paths (e.g., /mqtt).
Tested with wss://

@shamblett shamblett changed the base branch from master to pr607 June 6, 2025 07:49
@shamblett shamblett merged commit c389655 into shamblett:pr607 Jun 6, 2025
2 checks passed
@shamblett
Copy link
Owner

Thanks, good addition, Is there any reason you know why this can't be added to the browser client?

@racknoris
Copy link
Author

You're welcome, hope it will help others as well.
I should dig deeper into the mqtt concept to answer properly because I saw the issue with constant path in the Uri, so it seemed appropriate to transfer an internal path and "inject" it into the class where needed. I believe it is safe to assume flutter web will behave the same, so I'll make the changes in the browser section and test against "ws://" but it will take some time to get to that.

Thank you for the quick merge and response

@shamblett
Copy link
Owner

Great thanks, I only ask because the path is part of the Uri, not a specific option on the web socket like timeouts for instance, the Uri is common to both so I think should be OK. Also, its only an option, it doesn't exist at the moment and in the future if someone uses it and we hit problems we can address it then. The client is not forcing this on anybody.

No problem with the timescale, please note you now have a branch for this named pr607 no need to use master.

@racknoris
Copy link
Author

Ok I understand

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

Successfully merging this pull request may close these issues.

2 participants