UNPKG

@mos-connection/connector

Version:
45 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Server = void 0; /** */ class Server { constructor() { // private _connected: boolean // private _lastSeen: number this._sockets = {}; } /** */ registerIncomingConnection(socketID, socket, portDescription) { this._sockets[socketID + ''] = { socket: socket, portDescription: portDescription, }; } /** */ removeSocket(socketID) { delete this._sockets[socketID + '']; } _getSockets(portDescription) { const sockets = []; for (const i in this._sockets) { if (this._sockets[i].portDescription === portDescription) { sockets.push(this._sockets[i].socket); } } return sockets; } /** */ get lowerPortSockets() { return this._getSockets('lower'); } /** */ get upperPortSockets() { return this._getSockets('upper'); } /** */ get queryPortSockets() { return this._getSockets('query'); } } exports.Server = Server; //# sourceMappingURL=Server.js.map