Open ecostanzi opened 4 years ago
We should be able to implement a custom subprotocol handler and provide it in the ws.subprotocol.handler.class(comma separated) parameter in websocket inbound configuration which will handle the custom subprotocol. A sample handler can be found in [1].
from @sameeragunarathne
Thanks @bhathiya, is it something we can configure on our instance of carbon or has it to be fixed in the source code of carbon?
No we haven't done this yet. You can do a custom implementation and plug until we have it in the product someday.
Any solution to share please ?
Description
I'm creating a js app that connects to a spring app via websocket and stomp. This app always work when connecting directly to the websocket, but fails on Chrome when using the API gateway.
When connecting directly to the service it always works
When connecting to the service via API Manager does NOT work on chrome:
The error is
Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
.Motivation
The request contains the websocket subprotocols in the
Sec-Websocket-Protocol
:The response returned by the service (contains the
Sec-Websocket-Protocol
):The response returne by the API Manager (does NOT contain the
Sec-Websocket-Protocol
header:The above response is not accepted by chrome, chrome needs the
Sec-WebSocket-Protocol
in the response.According to this website: https://whatpr.org/html/4105/web-sockets.html "The connection will only be established if the server reports that it has selected one of these subprotocols"
Steps to reproduce:
ws://the-spring-app:8080/gs-guide-websocket
stompClient = Stomp.client("ws://my-spring-service:8080/gs-guide-websocket");
-> It works because the spring app returns all the hadersstompClient = Stomp.client("ws://my-wso2-instance:9099/wsocket/1.0.0?access_token=<my-token>");
--> it does NOT work due to the missing headerAffected Product Version:
WSO2 API-M v3.1.0 Beta
Environment details (with versions):
Optional Fields
Related Issues:
Suggested Labels:
Suggested Assignees: