/** * Handlers for RDP/VNC sessions. * Context: rdpManager, debugLog */ function register(deps) { const { rdpManager, debugLog } = deps; return [ { type: 'startRdpSession', handle: async (payload, reply) => { debugLog('startRdpSession: type=', payload.type, 'label=', payload.label); const result = await rdpManager.startSession(payload); debugLog('startRdpSession: result=', JSON.stringify({ ok: result.ok, sessionId: result.sessionId, wsPort: result.wsPort })); reply(result); } }, { type: 'stopRdpSession', handle: async (payload, reply) => { debugLog('stopRdpSession: sessionId=', payload.sessionId); const result = await rdpManager.stopSession(payload); reply(result); } }, { type: 'getRdpSessions', handle: async (payload, reply) => reply({ ok: true, sessions: rdpManager.getSessions() }) } ]; } module.exports = { register };