result.html 1013 Bytes
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>websocket client</title>

    <script type="text/javascript">
        var ws1 = null;
        var ws2 = null;
        function myFunction() {
            ws1 = new WebSocket("ws://localhost:8100/websocket/testResult/" + "web");
            ws1.onmessage = function (evt) {
                console.log(evt);
                var received_msg =JSON.parse(evt.data) ;
                const nameValue = Object.values(received_msg)
                var context = '<div class="sendMsg">' +
                    'aflnet:<br/>'+
                    'aflnet<h3>'+nameValue+'</h3><br/>'+
                    '      </div>';
                document.getElementById("sendDiv").innerHTML = context;
            };
            ws1.onclose = function () {

                // 关闭 websocket
                alert("连接已关闭...");
            };
        }
    </script>
<body  onload="javascript:myFunction()">
<div id="sendDiv">

</div>

</body>
</html>