1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 11:27:06 +00:00

add a raw gorilla websocket example

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-02 21:22:42 +03:00
parent 676048666c
commit dfa08041a1
5 changed files with 205 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<!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>