memory leak on reconnection when `closeOnBeforeunload` is true
rluvaton opened this issue · comments
Describe the bug
It looks like there is a memory leak of closeOnBeforeunload
listener in case it fails to connect to WebSocket and tries to connect again
Sorry for not sticking with the issue template but I'm going to fix it if you think that it is indeed a memory leak
So why the memory leak? I've noticed while debugging my application that the beforeunload
listener keeps adding up by socket io client
As we see here:
engine.io-client/lib/socket.ts
Lines 355 to 366 in dfee8de
But, in the onClose
we don't remove that listener:
engine.io-client/lib/socket.ts
Lines 894 to 932 in dfee8de
just making sure that I'm correct and if so I'll create a PR to fix that...