I developed a live view application using Elixir, specifically a Phoenix application, and have been running it in the browser for an extended period of time. Occasionally, I encounter an error, such as net::ERR_CONNECTION_RESET, which completely removes the socket connection and prevents automatic reconnection. It appears as though the server is unable to transmit data to the client. To address this issue, I implemented error protection logic in my application. However, I would like to test the end-to-end flow of this error, but I am having difficulty reproducing the net::ERR_CONNECTION_RESET error in my Chrome browser.
Is it possible to replicate the net::ERR_CONNECTION_RESET error at the client-side when making an API call or using a WebSocket?
ERR_CONNECTION_RESET is a TCP-level error, which means the other end of the TCP connection sends a TCP packet with the
RST flag set to 1.
screenshot taken from Wikipedia
The most common cause I have experienced is China’s evil and notorious Great Fire Wall (GFW) that sits in the middle of the client and the server, and sends
RST packet to both ends to fool them that the other end does not want to establish such connection. If that’s the case, your only choice is to use a proxy or a VPN to bypass GFW.
net:ERROR_CONNECTION_RESET occurred due to a slow internet connection, which caused the
To simulate the issue, I used a tool such as Fiddler or Wireshark to intercept or delay the connection. Specifically, I closed the network for
localhost:5000/js/app.js, which prevented
app.js from loading and triggered the aforementioned error