-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo.html
42 lines (34 loc) · 825 Bytes
/
echo.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
41
42
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Websocket BASH</title>
<script language="javascript" type="text/javascript">
function init() {
// first run echo.sh on localhost
WS = window.WebSocket || window.MozWebSocket;
ws = new WS("ws://localhost:1337");
ws.onopen = function(e) {
console.log(e);
send("BASH NUGGETS?");
};
ws.onclose = ws.onerror = function(e) {
console.log(e);
};
ws.onmessage = function(e) {
console.log("RECEIVED: " + e.data);
// ws.close();
};
}
function send(message) {
console.log("SENT: " + message);
ws.send(message);
}
window.addEventListener("load", init);
</script>
</head>
<body>
<h1>Websocket BASH</h1>
<p>Please see your Web Inspector for output.</p>
</body>
</html>