Rewrite websocket for Lua (Step 16 of ?)