adds WebSocket thread and command-line options, and fixes capture code