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

The websocket connection won't go through the zuul filters. #9

Open
jasonkoo opened this issue Nov 8, 2017 · 1 comment
Open

The websocket connection won't go through the zuul filters. #9

jasonkoo opened this issue Nov 8, 2017 · 1 comment

Comments

@jasonkoo
Copy link

jasonkoo commented Nov 8, 2017

In the following link, someone says this library is not really zuul websocket support, it's a standalone websocket proxy that happens to sit next to zuul. And I configured a zuul mandatory filter and found that the websocket connection did not go through the zuul filter.

My question is what's the implementation consideration of this library? Is it possible to make the websocket connection go through the zuul filter? To put it in another way, is it possible to support the websocket connection in zuul filters by using spring websocket compoment?

Thank you.

spring-cloud/spring-cloud-netflix#163

@sylank
Copy link

sylank commented May 1, 2018

Hi jasonkoo!

Websocket calls are not HTTP requests. HTTP protocol is based on TCP sockets. So when you create a HTTP request (e.g.: HTTP_GET, HTTP_POST, ..) the Tomcat and Spring and Zuul will create RequestContext. You can run your filters in this context and you are able to route your call.

BUT, as I mentioned before, websocket calls are on the tcp layer and it is lower than the HTTP calls. The application server will not create a RequestContext because it is not a HTTP request.

When you connect to a websocket server, the client send a http request to do the handshake process. At this point you can run some of your filters.
When you disconnect from it, the client will not send http call to do the disconnect process :(.

After all, you can not use your already implemented filters. You have to create new ones because of the "new" architecture. You have to figure out new backend logic to handle websocket connections and messages. And do not forget the websocket is a full-duplex communication channel ;).

Best wishes :)

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

No branches or pull requests

2 participants