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

be explicit/use examples in websocket.next docs when it comes to subscribe call for action #42566

Closed
maxandersen opened this issue Aug 15, 2024 · 3 comments · Fixed by #44556
Closed
Assignees
Labels
Milestone

Comments

@maxandersen
Copy link
Member

Description

Trying to use websockets.next primiarly the client but i see similar challenges with server side.

reading https://quarkus.io/guides/websockets-next-reference there are a mix of places where it says things like:

"The method must subscribe to the Multi to receive these items (or return a Multi)."

and

"Sends a text message to the client. It returns a Uni. It's non-blocking, but you must subscribe to it."

..and no example so is this saying that i.e. it must be .sendText(msg).subscribe() or must it be .sendText(msg).subscribe().with(()->{}); ? we should provide examples in these places to reduce ambiguity/errors.

Implementation ideas

I would make a PR for these but I'm not actually sure what the required minimal samples are ;)

@mkouba
Copy link
Contributor

mkouba commented Sep 9, 2024

..and no example so is this saying that i.e. it must be .sendText(msg).subscribe() or must it be .sendText(msg).subscribe().with(()->{}); ? we should provide examples in these places to reduce ambiguity/errors.

I think that in general users will not subscribe to the returned Uni. I.e. when building a reactive stream it's usually the framework that handles subscription. And if not dealing with reactive then use the ...AndAwait() methods and blocking signatures.

I would make a PR for these but I'm not actually sure what the required minimal samples are ;)

I'm not sure either.

CC @cescoffier

@cescoffier
Copy link
Member

We may need a warning containing the code showing how to subscribe but making it clear that the framework is usually subscribing. Explaining when it does subscribe and when it does not is tricky—it depends on the used extensions.

@cescoffier cescoffier self-assigned this Nov 11, 2024
@cescoffier
Copy link
Member

Assigning it to me, I will update the documentation.

cescoffier added a commit to cescoffier/quarkus that referenced this issue Nov 18, 2024
cescoffier added a commit to cescoffier/quarkus that referenced this issue Nov 19, 2024
@mkouba mkouba closed this as completed in 03a5ea7 Nov 20, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in WG - WebSocket Next Nov 20, 2024
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
3 participants