InputAndEmit
@tsed/socketio
Usage
typescript
import { InputAndEmit } from "@tsed/socketio";
See /packages/third-parties/socketio/src/types/decorators/inputAndEmit.ts.
Overview
ts
function InputAndEmit(eventName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
Description
Attach the decorated method to the socket event and emit the response to the client.
Example
typescript
@SocketService("/nsp")
export class MyWS {
@InputAndEmit("event")
async myMethod(@Args(0) data: any, @Nsp socket) {
return {data: "data"};
}
}