UNPKG

@sodacore/ws

Version:

Sodacore ws is a core plugin that extends the Http plugin offering WebSocket support to the Sodacore framework.

19 lines (18 loc) 693 B
import { Utils } from '@sodacore/di'; /** * Will add metadata to the class to define it's module status * and register the WS service access and the required namespace * that can then be used to trigger the controller. * @param path Optional base path. * @returns ClassDecorator * @default */ export default function Controller(namespace) { return (target) => { Utils.setMeta('type', 'autowire')(target, 'controller'); Utils.setMeta('namespace', 'ws')(target, namespace); const services = Utils.getMeta('services', 'controller')(target, undefined, []); services.push('ws'); Utils.setMeta('services', 'controller')(target, services); }; }