You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Critically If a "Content-Length: 0" header is included in the "101 Switching Protocols" response from a WebSocket server, WebSocketClient gets confused and schedules the connection for cleanup in 100 seconds. and According to RFC 7230 Section 3.3.2, Content-Length is prohibited in 1xx (Informational) messages. Using Wireshark I confirmed that the ESPAsyncWebServer was indeed including the "Content-Length: 0" header in the "101 Switching Protocols" response.
I have successfully resolved the issue by adding line
_sendContentLength = false;
after
_server = server;
_code = 101;
at the top of AsyncWebSocketResponse::AsyncWebSocketResponse in AsyncWebSocket.cpp.
Now the client happily remains connected to the server. 😃 😃 😃
Also want to say what a great library ESPAsyncWebServer is. Had been using ESP8266WebServer and not only was it slow but http: page requests to the server often resulted in corrupted websocket messages and exceptions being raised in the client. None of that now.
The text was updated successfully, but these errors were encountered:
This is my first post (so please take it easy on me); I would like to share an issue I've been having and how I resolved it. I have an ESP8266 running ESPAsyncWebServer which connects to a .net ClientWebSocket. Client connected just fine, websocket dialogue ensued, then after 100 seconds the client closed the connection. Google revealed the following similar issues .NET WebSockets forcibly closed despite keep-alive and activity on the connection and WebSocket Implementation Disconnects Every 100 Seconds
Critically If a "Content-Length: 0" header is included in the "101 Switching Protocols" response from a WebSocket server, WebSocketClient gets confused and schedules the connection for cleanup in 100 seconds. and According to RFC 7230 Section 3.3.2, Content-Length is prohibited in 1xx (Informational) messages. Using Wireshark I confirmed that the ESPAsyncWebServer was indeed including the "Content-Length: 0" header in the "101 Switching Protocols" response.
I have successfully resolved the issue by adding line
after
at the top of
AsyncWebSocketResponse::AsyncWebSocketResponse
inAsyncWebSocket.cpp
.Now the client happily remains connected to the server. 😃 😃 😃
Also want to say what a great library ESPAsyncWebServer is. Had been using ESP8266WebServer and not only was it slow but http: page requests to the server often resulted in corrupted websocket messages and exceptions being raised in the client. None of that now.
The text was updated successfully, but these errors were encountered: