Rewrite websocket for Lua (Step 10 of ?)