Fixed WebSocket detection to support CocoonJS