ci(socket tester): added in transports and a new update button
This commit is contained in:
@@ -58,13 +58,23 @@
|
||||
<button type="button" id="btnCopyLatest">Send</button>
|
||||
</form>
|
||||
</div>
|
||||
<button id="btnUpdateServer">Server Update</button>
|
||||
</div>
|
||||
|
||||
<div id="logWindow"></div>
|
||||
|
||||
<script>
|
||||
// ✅ Define socket in global scope
|
||||
const socket = io("http://localhost:8000");
|
||||
|
||||
// const socket = io("https://usmcd1vms036.alpla.net", {
|
||||
// path: "/lst/socket.io/",
|
||||
// transports: ["polling"],
|
||||
// });
|
||||
|
||||
const socket = io("http://localhost:8080", {
|
||||
path: "/socket.io/",
|
||||
transports: ["polling"],
|
||||
});
|
||||
|
||||
// log window reference
|
||||
const logWindow = document.getElementById("logWindow");
|
||||
@@ -140,7 +150,10 @@
|
||||
if (!fromMyInput) return;
|
||||
|
||||
// Emit to backend (adjust event name as required)
|
||||
socket.emit("update", fromMyInput);
|
||||
socket.emit("update", {
|
||||
action: "copy",
|
||||
target: fromMyInput,
|
||||
});
|
||||
|
||||
// You can define your own logMessage function
|
||||
logMessage("info", `Copying to ${fromMyInput}`);
|
||||
@@ -151,6 +164,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
document.getElementById("btnUpdateServer").onclick = () => {
|
||||
socket.emit("update", {
|
||||
action: "update",
|
||||
target: "usmcd1vms036",
|
||||
}); // "frontend" = payload target
|
||||
logMessage("update", "Update The server");
|
||||
};
|
||||
|
||||
socket.on("logs", (msg) => logMessage("logs", msg));
|
||||
socket.on("errors", (msg) => logMessage("errors", msg));
|
||||
socket.on("buildlogs", (msg) => logMessage("build", msg));
|
||||
|
||||
Reference in New Issue
Block a user