You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
744 B
31 lines
744 B
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
</head>
|
|
<body>
|
|
<h1>Всем привет , дети мои!!</h1>
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
var url = 'ws://127.0.0.1:8888/chat';
|
|
var socket = new WebSocket(url);
|
|
|
|
socket.onopen = function(){
|
|
console.log("Соединение установлено");
|
|
socket.send("start");
|
|
}
|
|
|
|
socket.onmessage = function (event) {
|
|
console.log(event.data);
|
|
alert(event.data);
|
|
var data = JSON.parse(event.data);
|
|
console.log(data);
|
|
}
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|