mirror of
https://github.com/Estom/notes.git
synced 2026-02-10 13:56:30 +08:00
pysyft 博客看完
This commit is contained in:
24
Python/web_socket_test/index.html
Normal file
24
Python/web_socket_test/index.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>WebSocket Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var wsObj = new WebSocket("ws://127.0.0.1:5678"); //建立连接
|
||||
wsObj.onopen = function(){ //发送请求
|
||||
alert("open");
|
||||
wsObj.send("admin:123456");
|
||||
};
|
||||
wsObj.onmessage = function(ev){ //获取后端响应
|
||||
alert(ev.data);
|
||||
};
|
||||
wsObj.onclose = function(ev){
|
||||
alert("close");
|
||||
};
|
||||
wsObj.onerror = function(ev){
|
||||
alert("error");
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user