This was causing subsequent websockets on the same url to fail to upgrade properly for me.
There is still another, unrelated issue related to repeatedly creating and destroying websockets on the same URL. Because this could get confusing quickly I'm going to note in big bold letters here: This Patch Does Not Fix Issue #241.
Running the included patched test against the current eianros:master should fail whereas running it against this branch should succeed.
In the immortal words of Douglas Adams: "Share and Enjoy"
Cleaning up server event listeners in WebSocketServer close
Patching for Cannot call method 'removeListener' of undefined
Closing this as it seems that this change is no longer necessary. Please comment or reopen if needed.