Open
Description
Describe the bug
The documentation states that middleware errors should stop the client from reconnecting. However, this does not seem to be the case for middleware created using io.engine.use.
To Reproduce
Socket.IO server version: 4.7.5
Socket.IO client version: 4.7.5
Server
For example, let's create two middlewares that will trigger errors:
First:
io.use((socket, next) => {
next(new Error('thou shall not pass and stop'))
})
Second:
io.engine.use((req, res, next) => {
next(new Error('thou shall not pass'))
})
Client
Log the response as follows:
socket.on('connect_error', (err) => {
console.log('websocket error:', err.message, socket.active)
})
Using the first middleware, the response is:
websocket error: thou shall not pass and stop false
Using the second middleware, however, the response is:
websocket error: xhr poll error true
websocket error: xhr poll error true
websocket error: xhr poll error true
...
Expected behavior
I'm not sure if I missed something, but I believe that this type of middleware should, in fact, stop reconnections!
Platform:
- Device: PC
- OS: Windows 10