tweaked WebSocket example