lianjunwei opened a new issue, #4835:
URL: https://github.com/apache/shenyu/issues/4835

   ### Is there an existing issue for this?
   
   - [X] I have searched the existing issues
   
   ### Current Behavior
   
   
   Use shenyu gateway to proxy websockets for backend services.
   Encountered a problem when closing a connection using a specific status code 
(such as 4400). If connected directly, the custom code and reason will be 
returned to the client. But when using shenyu gateway proxy, both code and 
reason will be lost.
   
   ### Expected Behavior
   
   
   
![image](https://github.com/apache/shenyu/assets/13819823/e8ecb9f4-5e26-44ea-93c2-66ffdb6f6cf9)
   
   
   ### Steps To Reproduce
   
   1.run: shenyu-example-spring-native-websocket
   The key codes are as follows:
   ```java
   protected void handleTextMessage(final WebSocketSession session, final 
TextMessage message) throws Exception {
           // Get the message from the client.
           String payload = message.getPayload();
           Object token = session.getAttributes().get("token");
           LOG.info("server received {}, sent {}", token, payload);
           if (Objects.nonNull(payload) && Objects.equals(payload, 
"testCloseStatus")) {
               session.close(new CloseStatus(4400, "test:apache shenyu server 
close, return closeStatus"));
           }else{
               session.sendMessage(new TextMessage("apache shenyu server send 
to " + token + " message : -> " + payload));
           }
       }
   ``` 
   
   2. run shenyu-gateway
   3. send request: ws://127.0.0.1:8868/myWebSocket?token=123
       
   
![proxy-ws-error](https://github.com/apache/shenyu/assets/13819823/f61c1452-8c6f-4ea9-8bfa-dd6fc0c180e8)
   
   
   ### Environment
   
   ```markdown
   all versions.
   ```
   
   
   ### Debug logs
   
   _No response_
   
   ### Anything else?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to