Skip to content

Add support for topic subscribing via WebSockets (#17)#18

Open
corentincam wants to merge 6 commits intoshadowylab:masterfrom
corentincam:17-subscribing-support
Open

Add support for topic subscribing via WebSockets (#17)#18
corentincam wants to merge 6 commits intoshadowylab:masterfrom
corentincam:17-subscribing-support

Conversation

@corentincam
Copy link

Here is my (successful) attempt at adding support for topic subscribing (blocking and async).

I added separate features as it adds some dependencies and I guess most people will use this lib to publish messages, not receive them.

Also, I added async-std and tokio features as async-tungstenite has them and we need to choose which module to use according to the async provider.

I'm sure this part could be better but my knowledge of async rust is not huge so don't hesitate to tell me if there's a better way.

Another thing: I couldn't add proxy support easily (see this and this), so I decided to make subscribing and socks features incompatible. Although they technically can be activated altogether, I don't want users to think proxy will work when subscribing to topics (even though there's no API for proxy in subscribers).

Those two last points break the checks with all features, I'm not sure how to resolve that.

I also took the liberty of adding a .rustfmt.toml file because my editor kept reordering imports on save, I can remove it if you don't want it.

@corentincam corentincam force-pushed the 17-subscribing-support branch 2 times, most recently from 6920fac to 68f4c40 Compare March 5, 2026 13:53
Copy link
Member

@yukibtc yukibtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @corentincam

I've marked few changes to do.

@corentincam corentincam force-pushed the 17-subscribing-support branch 2 times, most recently from b5702ab to c4c5f7b Compare March 13, 2026 10:05
@corentincam corentincam force-pushed the 17-subscribing-support branch from c4c5f7b to f042359 Compare March 13, 2026 10:14
@corentincam corentincam force-pushed the 17-subscribing-support branch from f042359 to 976ea19 Compare March 13, 2026 10:21
@corentincam
Copy link
Author

About the subscribing/proxy conflict, I decided to add a proxy method to the subscriber builder that panics saying that proxies are not supported by subscribers.

That way the checks can work with all features enabled.

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