<html> <body onload="init()"> <input id="su" value="sendit" type="submit" /> <script> var WsHandler={ }; function init() { WsHandler.ws= new WebSocket( "wss://192.168.1.176:8443/baseapp/wss" ); WsHandler.ws.onopen = function(evt) { WsHandler.ws.onmessage = function(e){ console.log('recv: '+ e.data); }; WsHandler.SendMsg=WsHandler.ws.send; }; var a=0; function sendit(){ WsHandler.SendMsg("v"+a++); } document.getElementById("su").addEventListener("click",sendit,false); } </script> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)