-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
40 lines (27 loc) · 940 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE HTML>
<html>
<head>
<h1>A Question</h1>
<label for="fname">Your Response</label>
<input type="text" id="chattext"><br><br>
<button onclick="sendChat()">send</button>
<script type = "text/javascript">
function sendChat() {
//var ws = new WebSocket("wss://websocket.jieguann.com");
var ws = new WebSocket("ws://127.0.0.1:1880/response");
// var ws = new WebSocket("ws://localhost:8080");
if ("WebSocket" in window) {
ws.onopen = function() {
ws.send(document.getElementById('chattext').value)
document.getElementById('chattext').value = null; //alert("Message is sent...");
};
}
console.log(document.getElementById('chattext').value )
//console.log(document.getElementById('chattext').value)
}
</script>
</head>
<body>
</div>
</body>
</html>