Improve the WebSocket API (#133)