drogonframework / drogonframework/drogon
WebSockets not forwarded
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
**Describe the bug**
Using `drogon::app().forward(...)` to forward WebSockets does not work.
Tried by having it forward with "http://..." prefix as host, and it is able to establish a WebSocket connection, but can't maintain the connection or send/receive messages, it ends up disconnecting with this logged in the terminal on the forwarder's side:
```
20240418 14:04:08.810934 UTC 178355 ERROR More responses than expected! - HttpClientImpl.cc:616
```
As for the receiver, it only gets the new WebSocket connection established, and nothing else after that point.
Also tried forwarding with "ws://..." prefix as host, and it is unable to establish any WebSocket connections.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a server with a WebSocket endpoint `/ws`, listening on port 9090.
2. Create another server with a preRoutingAdvice that forwards to "http://127.0.0.1:9090", and itself listening on port 8080
3. Make a WebSocket connection request to `ws://127.0.0.1:8080/ws`
4. Observe its behavior
**Expected behavior**
WebSockets should forward.
**Desktop:**
- OS: Ubuntu
**Additional context**
On a production server it is unable to connect at all.
Contributor guide
Assessment
This issue has not been assessed yet.