1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-03 00:56:59 +02:00
Files
echo/recipes/websocket/public/index.html

34 lines
614 B
HTML
Raw Normal View History

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WebSocket</title>
</head>
<body>
<pre>
</pre>
<script>
var loc = window.location;
var uri;
if (loc.protocol === 'https:') {
uri = 'wss:';
} else {
uri = 'ws:';
}
uri += '//' + loc.host;
uri += loc.pathname + 'ws';
ws = new WebSocket(uri)
ws.onopen = function() {
console.log('Connected')
}
ws.onmessage = function(evt) {
console.log('Message')
}
</script>
</body>
</html>