[fix] implement WebSocket avoidance for Socket.IO. Fixes #50

Had to redo a bit of it as the original pull request broke server side as the `io` variable was undefined.