Watch 1 Star 13 Fork 4

saberyjs / php-websocket-base-implementionPHPMIT

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
php实现基本的websocket协议 spread retract

Clone or download
websocket.html 705 Bytes
Copy Edit Web IDE Raw Blame History
saberyjs authored 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>

Comment ( 0 )

Sign in for post a comment

PHP
1
https://gitee.com/obamajs/php-websocket-base-implemention.git
git@gitee.com:obamajs/php-websocket-base-implemention.git
obamajs
php-websocket-base-implemention
php-websocket-base-implemention
master

Help Search