@sevenqi/nodechannel
Version:
nodejs channel
44 lines • 1.91 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseAppServer = void 0;
var sessionManager_1 = require("./sessionManager");
var BaseAppServer = /** @class */ (function (_super) {
__extends(BaseAppServer, _super);
function BaseAppServer(ctorSession, ctorChannel) {
var _this = _super.call(this) || this;
_this.ctorChannel = ctorChannel;
_this.ctorSession = ctorSession;
return _this;
}
BaseAppServer.prototype.connection = function (duplex, filter) {
var session = new this.ctorSession(new this.ctorChannel(duplex, filter), this.callback);
session.onClose = this.remove.bind(this);
session.onMessage = this.callback.bind(this);
this.sessions.set(session.id, session);
};
BaseAppServer.prototype.listen = function () {
};
BaseAppServer.prototype.onServerData = function (func) {
this.callback = func;
};
BaseAppServer.prototype.disListen = function () {
};
return BaseAppServer;
}(sessionManager_1.SessionManager));
exports.BaseAppServer = BaseAppServer;
//# sourceMappingURL=appServer.js.map