mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
22 lines
710 B
HTML
22 lines
710 B
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>WebSocket Example</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="fileData">{{.Data}}</pre>
|
||
|
<script type="text/javascript">
|
||
|
(function() {
|
||
|
var data = document.getElementById("fileData");
|
||
|
var conn = new WebSocket("ws://{{.Host}}/ws?lastMod={{.LastMod}}");
|
||
|
conn.onclose = function(evt) {
|
||
|
data.textContent = 'Connection closed';
|
||
|
}
|
||
|
conn.onmessage = function(evt) {
|
||
|
console.log('file updated');
|
||
|
data.textContent = evt.data;
|
||
|
}
|
||
|
})();
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|