@loopback/socketio
Version:
LoopBack's WebSocket server based on socket.io
38 lines • 1.72 kB
JavaScript
// Copyright IBM Corp. and LoopBack contributors 2020. All Rights Reserved.
// Node module: @loopback/socketio
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultSocketIoSequence = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");
const keys_1 = require("./keys");
let DefaultSocketIoSequence = class DefaultSocketIoSequence {
constructor(context, controller, invoke, send, reject) {
this.context = context;
this.controller = controller;
this.invoke = invoke;
this.send = send;
this.reject = reject;
}
async handle(methodName, args, done) {
try {
const result = await this.invoke(this.context, this.controller, methodName, args);
await this.send(done, result);
}
catch (err) {
await this.reject(done, err);
}
}
};
exports.DefaultSocketIoSequence = DefaultSocketIoSequence;
exports.DefaultSocketIoSequence = DefaultSocketIoSequence = tslib_1.__decorate([
tslib_1.__param(0, core_1.inject.context()),
tslib_1.__param(1, (0, core_1.inject)(core_1.CoreBindings.CONTROLLER_CURRENT)),
tslib_1.__param(2, (0, core_1.inject)(keys_1.SocketIoBindings.INVOKE_METHOD)),
tslib_1.__param(3, (0, core_1.inject)(keys_1.SocketIoBindings.SEND_METHOD)),
tslib_1.__param(4, (0, core_1.inject)(keys_1.SocketIoBindings.REJECT_METHOD)),
tslib_1.__metadata("design:paramtypes", [core_1.Context, Object, Function, Function, Function])
], DefaultSocketIoSequence);
//# sourceMappingURL=socketio.sequence.js.map
;