Welcome to mirror list, hosted at ThFree Co, Russian Federation.

javascript_client_example.html - github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ac644c1c1fdecb6686e42c50f925260c2f58aa1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WebSocket Test</title>
</head>
<body>
<script>
var ws;
window.onload=function(){
  ws=new WebSocket("ws://localhost:8080/echo");
  ws.onmessage=function(evt){console.log(evt.data);};
  ws.onopen=function(evt){
    ws.send("Hello");
  }
}
window.onclose=function(){
  ws.close();
}
</script>
</body>
</html>