UNPKG

proctokit

Version:

A server-side SDK for a secure online proctoring system, enabling real-time monitoring of exam sessions.

50 lines (43 loc) 1.55 kB
const EventEmitter = require('events'); const ProctorConfig = require('./config/ProctorConfig'); // --- FIX: Corrected the relative paths to be inside the 'lib' directory --- const SessionManager = require('./session/SessionManager'); const ProctorWebsocketServer = require('./websocket/ProctorWebsocketServer'); /** * The final, production-ready entry point for the Proctoring SDK for Node.js. * This version provides installer links to facilitate OS-aware downloads on the frontend. * * @fires ProctorSDK#session */ class ProctorSDK extends EventEmitter { /** * @param {ProctorConfig} config The configuration object for the SDK. */ constructor(config) { super(); this.config = config; this.sessionManager = new SessionManager((session) => this.emit('session', session)); this.server = new ProctorWebsocketServer(this.config, this.sessionManager); } /** * Starts the internal WebSocket server. */ start() { this.server.start(); } /** * Stops the internal WebSocket server. */ stop() { this.server.stop(); } /** * Returns the object of installer URLs provided during configuration. * @returns {Object.<string, string>} An object mapping OS to installer URL. */ getInstallerLinks() { return this.config.installerUrls; } } // We export both the main SDK class and the Config class for convenience. module.exports = { ProctorSDK, ProctorConfig };