fix: fixed warn info
This commit is contained in:
1 parent
5e710f6693
commit
d18a93f129
11 files changed
+43
-44
No files matched your search
+19
-8
@@ -14,15 +14,26 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const socket = new WebSocket("ws://localhost:8080/ws");
|
||||
|
||||
socket.addEventListener("message", function (event) {
|
||||
console.log(event);
|
||||
if (event.data === "reload") {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
(function () {
|
||||
var protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
||||
var url = protocol + "//" + window.location.host + "/ws";
|
||||
var poll_interval = 2000;
|
||||
var reload_upon_connect = () => {
|
||||
window.setTimeout(() => {
|
||||
var ws = new WebSocket(url);
|
||||
ws.onopen = () => window.location.reload();
|
||||
ws.onclose = reload_upon_connect;
|
||||
}, poll_interval);
|
||||
};
|
||||
|
||||
var ws = new WebSocket(url);
|
||||
ws.onmessage = (ev) => {
|
||||
if (ev.data == "reload") {
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
ws.onclose = reload_upon_connect;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user