！' });
            };

            ws.onmessage = function(event) {
                console.log('Received Message:', event.data);
                try {
                    const data = JSON.parse(event.data);
                    displayLog(data);
                } catch (e) {
                    console.error('Failed to parse message:', e);
                    displayLog({ type: 'error', data: `收到无法解析的消息: ${event.data.substring(0, 100)}...` });
                }
            };

         