debug logging
This commit is contained in:
@@ -7,6 +7,7 @@ const cmd = document.getElementById("status");
|
|||||||
document.body.style.backgroundImage = "url('tiles/tile_" + Math.floor(20 * Math.random()) + ".png')";
|
document.body.style.backgroundImage = "url('tiles/tile_" + Math.floor(20 * Math.random()) + ".png')";
|
||||||
|
|
||||||
if (window.WebSocket) {
|
if (window.WebSocket) {
|
||||||
|
// https://github.com/novnc/noVNC/blob/master/docs/API.md
|
||||||
const rfb = new RFB(
|
const rfb = new RFB(
|
||||||
document.getElementById("display"),
|
document.getElementById("display"),
|
||||||
"wss://spin-vm.jrvs.io",
|
"wss://spin-vm.jrvs.io",
|
||||||
@@ -14,6 +15,12 @@ if (window.WebSocket) {
|
|||||||
wsProtocols: ["binary", "base64"],
|
wsProtocols: ["binary", "base64"],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
rfb.addEventListener("connect", () => {
|
||||||
|
console.log("successfully connected to VM socket!");
|
||||||
|
});
|
||||||
|
rfb.addEventListener("disconnect", (detail) => {
|
||||||
|
console.warn("VM ended session remotely:", detail);
|
||||||
|
});
|
||||||
|
|
||||||
// give up after 15 seconds (this also is rendered behind the VNC display in case it crashes and goes poof)
|
// give up after 15 seconds (this also is rendered behind the VNC display in case it crashes and goes poof)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user