1 Star 0 Fork 6

lijian / php-websocket-base-implemention

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
websocket.html 705 Bytes
一键复制 编辑 原始数据 按行查看 历史
saberyjs 提交于 2019-11-19 11:44 . websocket.html bug fixed
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test websocket</title>
</head>
<body>
<script charset="UTF-8">
var ws = new WebSocket('ws://127.0.0.1:8080');
ws.onopen = function () {
setTimeout(function () {
//ws.send(JSON.stringify({type: 1, authId: 100}));
ws.send("martin123奥巴马");
}, 1000)
};
ws.onmessage = function (e) {
var h = document.createElement("h1");
h.innerHTML = e.data;
document.body.appendChild(h);
};
ws.onclose = function () {
// alert("closed");
};
ws.onerror = function () {
//alert("error happened");
};
</script>
</body>
</html>
PHP
1
https://gitee.com/lijian152/php-websocket-base-implemention.git
git@gitee.com:lijian152/php-websocket-base-implemention.git
lijian152
php-websocket-base-implemention
php-websocket-base-implemention
master

搜索帮助