Files
ziqim/zhiqim_httpd/resource/ws.htm
T
2025-02-20 14:59:35 +08:00

39 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>${context.getContextName()}</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="Author" content="${context.getContextName()}" />
${Scripts.src("/zinc/zhiqim_v1.4.0.r2018010101.min.js")}
<script>
var ws = null;
Z.onload(function()
{
ws = new WebSocket("ws://"+location.hostname+":"+location.port+"/service/ws", "zoa_announcement");
ws.onopen = function(){console.log("ws.onopen");};
ws.onclose = function(e){console.log("ws.onclose");};
ws.onerror = function(e){console.log("ws.onerror");};
ws.onmessage = function(e){console.log("ws.onmessage:"+e.data);if (e.data == "zoa_announcement_new"){top.Z.alert("有新的公告发布,请在方便的时候进入阅读,谢谢!");}};
Z.timer(1000, 100, null, send);
});
function send()
{
console.log("中文");
ws.send("一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十");
}
</script>
</head>
<body>
index.htm
<br><br>
<a href="abc.htm">abc.htm</a>
<a href="jdk-7u80-windows-x64.exe">下载</a>
</body>
</html>