-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhook_agentWebSocketDisconnected.js
31 lines (28 loc) · 1.39 KB
/
hook_agentWebSocketDisconnected.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
/**********************************************************************
* Copyright (C) 2025 BitCtrl Systems GmbH
*
* hook_agentWebSocketDisconnected.js
*
* @author Daniel Hammerschmidt <[email protected]>
* @author Daniel Hammerschmidt <[email protected]>
* @version 0.0.1
*********************************************************************/
const { PLUGIN_SHORT_NAME } = require('../pluginhookscheduler')({ __dirname, requiredPluginHooks: [ 'hook_afterCreateMeshAgent' ] });
let meshserver, webserver;
module.exports[PLUGIN_SHORT_NAME] = function (pluginHandler) {
meshserver = pluginHandler.parent;
return {
hook_afterCreateMeshAgent(meshagent, parent, db, ws, req, args, domain) {
ws.on('close', pluginHandler.callHook.bind(pluginHandler, 'hook_agentWebSocketDisconnected', meshagent));
// console.log(new Date().toISOString(), 'hook_afterCreateMeshAgent', encodeURIComponent(meshagent.nonce).slice(0, 24)), meshagent;
},
// // Usage:
// hook_agentCoreIsStable(meshagent) {
// console.log(new Date().toISOString(), 'hook_agentCoreIsStable', meshagent.agentName ?? meshagent.name ?? meshagent.nodeid );
// },
// hook_agentWebSocketDisconnected(meshagent) {
// console.log(new Date().toISOString(), 'hook_agentWebSocketDisconnected', meshagent.agentName ?? meshagent.name ?? meshagent.nodeid );
// },
};
};