UNPKG

@nestjs/websockets

Version:

Nest - modern, fast, powerful node.js web framework (@websockets)

17 lines (16 loc) 713 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebSocketGateway = void 0; const constants_1 = require("../constants"); function WebSocketGateway(portOrOptions, options) { const isPortInt = Number.isInteger(portOrOptions); // eslint-disable-next-line prefer-const let [port, opt] = isPortInt ? [portOrOptions, options] : [0, portOrOptions]; opt = opt || {}; return (target) => { Reflect.defineMetadata(constants_1.GATEWAY_METADATA, true, target); Reflect.defineMetadata(constants_1.PORT_METADATA, port, target); Reflect.defineMetadata(constants_1.GATEWAY_OPTIONS, opt, target); }; } exports.WebSocketGateway = WebSocketGateway;