There is websocket CGI extension I use right now. Your CGI script becomes a websocket endpoint. The extension is supported by simhttp for now, but more servers can support it in the future.