mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-09 04:00:46 +08:00
Identify alarm-push clients to NetX with hostname labels.
Send client=netxops@host on hub auth so NetX can distinguish multiple DSH subscribers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a4993b2407
commit
e6f9d062ed
2 changed files with 21 additions and 2 deletions
10
lib/index.js
10
lib/index.js
|
|
@ -222,7 +222,15 @@ function startAlarmPushClient(options) {
|
|||
}
|
||||
socket.addEventListener("open", () => {
|
||||
setPhase("authenticating", wsUrl, { detail: "auth" });
|
||||
socket?.send(JSON.stringify({ type: "auth", token }));
|
||||
let clientLabel = "netxops";
|
||||
try {
|
||||
const env = typeof process !== "undefined" ? process.env : undefined;
|
||||
const hostname = env?.HOSTNAME || env?.COMPUTERNAME;
|
||||
if (typeof hostname === "string" && hostname.trim()) {
|
||||
clientLabel = `netxops@${hostname.trim()}`;
|
||||
}
|
||||
} catch {}
|
||||
socket?.send(JSON.stringify({ type: "auth", token, client: clientLabel }));
|
||||
});
|
||||
socket.addEventListener("message", (event) => {
|
||||
let msg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue