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

Offer "websocket" option, when selecting Spring Webflux #16942

Closed
1 task done
Semo opened this issue Nov 8, 2021 · 5 comments
Closed
1 task done

Offer "websocket" option, when selecting Spring Webflux #16942

Semo opened this issue Nov 8, 2021 · 5 comments
Labels
Milestone

Comments

@Semo
Copy link

Semo commented Nov 8, 2021

Overview of the feature request

Please implement a "WebSockets using Spring Websocket" option, when a project with "reactive" Spring Webflux and Angular frontend was selected.

Motivation for or Use Case

I am to create a responsive website with a green meadow Spring Webflux backend and have to continuously update the Angular frontend with consumed information from a Kafka ensemble read by the Jhipster spring backend.

I selected Webflux when generating the project, but the option Websockets was not offered in the terminal options. So I had to integrate the required Spring maven packages into the pom.xml and implement WebSocketConfig, WebSocketSecurityConfig classes plus Endpoint on my own. The Angular client must authenticate in order to prove, if the user is allowed to read the processed messages.

Then I tried to connect with the Angular frontend to the backend and was asked for a JWT. It was impossible to connect. Perhaps some weird security configs of Spring which are like a closed book. Even when "permitAll" on everything, a connection wasn't possible. Even, if I use Postman as cUrl-GUI-Tool with websocket request generator, the connection was refused.

My 2nd try was to generate a non-reactive project with Jhipster, where I could dissect the "Tracker" example and integrate it into my project.

But here a huge amount of complex errors arised - mostly from maven package problems. I was able to solve them, but at this stage I wasn't able to solve it; Bean named 'corsFilter' is expected to be of type 'org.springframework.web.filter.CorsFilter' but was actually of type 'org.springframework.web.cors.reactive.CorsWebFilter'. It has perhaps something to do with the Spring Webflux and Spring MVC package interactions,

It would help to solve a lot of problems:

  • correct spring package (version), keeping the pom clean
  • solve the security problems
  • integrate fine into the URL mapping of the project
  • client won't have to poll the server each half-second
Related issues or PR
  • Checking this box is mandatory (this is just to show you read everything)
@mraible
Copy link
Contributor

mraible commented Nov 10, 2021

This comment from @cbornet might help explain why we don't offer it:

There's currently no support for security nor STOMP for websockets in WebFlux. So it seems hard to do much more than a hello world right now...
The recommendation seems to be to evaluate RSocket instead which I can only agree with 😃

@Tcharl
Copy link
Contributor

Tcharl commented Nov 11, 2021

So should jhipster move to RSocket instead of Websocket?

@Semo
Copy link
Author

Semo commented Nov 11, 2021

Thanks for your response. AFAIK, if a WebSocket connection is about to establish it does a handshake with the backend and requests an UPGRADE. Is it impossible to establish a "wss://" exchange with some "handler" and do an, i.e. JWT authenticated request?

Btw. I found that issue you mention webflux does not work with stomp and they would investigate on RSocket, but I don't understand what that means. Does JHipster "drop" that fancy WebSocket in favor of another "insert-fancy-lib-here" ;-) or call it RSocket?

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@deepu105
Copy link
Member

Given our websocket support is just minimal its not worth supporting in webflux IMO. It should be trivial to build for users using another method

@pascalgrimaud pascalgrimaud added this to the 7.5.0 milestone Jan 1, 2022
@pascalgrimaud pascalgrimaud reopened this Jan 11, 2022
@deepu105 deepu105 closed this as completed Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants