'Socket.io client flooding polling requests on webpack-dev-server, works fine on react-scripts

I currently have a socket.io server for java connecting to two different socket.io client applications. One is running on react-scripts and another is on webpack-dev-server. The socket connection works on both, but on the webpack-dev-server it sends about 100 polling packets a second after connecting. I am thinking it has something to do with the hot reload, although it happens on a fresh page. It's confirmed that the server and both clients are all running the same version of socket.io (4.4.1). I tried setting the transports to websocket to avoid the polling messages but it will not connect. On the react-scripts app it just sends a few polling packets and upgrades the connection without setting transports. Every polling request always returns a response of 6 on the webpack-dev-server if that helps. Any ideas of how to fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source