Files
threshold-ui/ui/desktop/electron-app/src/models/session-manager.js
T
Susmitha Girumala 56936f78b8 chore: Update cancel to stop for ipc sessions call
Additional cleanup: remove unused async calls, separate session and
associated manager models, & attempt encoding origin url as part of
sanitization for cli command
2021-05-12 15:31:28 -04:00

34 lines
754 B
JavaScript

const Session = require('./session.js');
class SessionManager {
#sessions = [];
/**
* Start a session and track it.
* Returns session proxy details if successfully started.
* @param {string} addr
* @param {string} target_id
* @param {string} token
* @param {string} host_id
*/
start(addr, target_id, token, host_id) {
const session = new Session(addr, target_id, token, host_id);
this.#sessions.push(session);
return session.start();
}
/**
* Stop a session using identifier.
* @param {string} session_id
*/
stopById(session_id) {
const session = this.#sessions.find((session) => session.id === session_id);
return session.stop();
}
stopAll() {
}
}
module.exports = SessionManager;