Python 3 compat: Improve WebSocket and tests