<!DOCTYPE HTML>
<html>
<head>
- <script type="text/javascript">
- function testStrapp() {
- document.getElementById("strapp-admin").innerHTML = "Dead"
- if ("WebSocket" in window) {
- const wsock = new WebSocket("wss://$HOST:$PORT")
- wsock.onopen = () => {
+ <title>Strapp.io Host</title>
+ <script type="text/javascript">
+ document.body = document.createElement('body')
+ const strappDiv = document.createElement('div')
+ document.body.appendChild(strappDiv)
+ strappDiv.innerHTML = "Connection Dead"
+ if ("WebSocket" in window) {
+ const wsock = new WebSocket("wss://$HOST:$PORT")
+ wsock.onopen = () => {
wsock.send("Test message")
- document.getElementById("strapp-admin").innerHTML = "Sent test"
- }
- wsock.onmessage = (evt) => {
- document.getElementById("strapp-admin").innerHTML = "Got Response\r\n" + evt.data
- }
- }
- else {
- document.getElementById("strapp-admin").innerHTML = "Your browser does not support Strapp"
- }
- }
- </script>
+ strappDiv.innerHTML = "Sent test"
+ }
+ wsock.onmessage = (evt) => {
+ strappDiv.innerHTML = "Got Response <br/>" + evt.data
+ }
+ } else {
+ strappDiv.innerHTML = "Your browser does not support Strapp"
+ }
+ </script>
</head>
- <body onload="javascript:testStrapp()">
- <div id="strapp-admin">
- Unterminated
- </div>
- </body>
</html>