UNPKG

@loopeco/socketio

Version:

A enhanced LoopBack's WebSocket server based on socket.io

15 lines (11 loc) 545 B
import {Context, ControllerClass, invokeMethod, Provider} from '@loopback/core'; import {SocketIoInvokeMethod} from '../types'; export class SocketIoInvokeMethodProvider implements Provider<SocketIoInvokeMethod> { constructor() {} value(): SocketIoInvokeMethod { return (context, controller, methodName, args) => this.action(context, controller, methodName, args); } action(context: Context, controller: ControllerClass, methodName: string, args: unknown[]) { return invokeMethod(controller, methodName, context, args); } }