Клиент сервер
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Counter App</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Счетчик: <span id="counter">0</span></h1>
|
||||
<button onclick="incrementCounter()">Увеличить счетчик</button>
|
||||
|
||||
<script>
|
||||
var ws = new WebSocket("ws://178.44.100.206:8765");
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
document.getElementById('counter').innerText = event.data;
|
||||
};
|
||||
|
||||
function incrementCounter() {
|
||||
ws.send("increment");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user