# Decorator InputAndEmit

Decorator
Module
import { InputAndEmit } from "@tsed/socketio"
Source/packages/socketio/src/decorators/inputAndEmit.ts

# Overview

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

@SocketService("/nsp")
export class MyWS {

  @InputAndEmit("event")
  async myMethod(@Args(0) data: any, @Nsp socket) {
     return {data: "data"};
  }
}
1
2
3
4
5
6
7
8

Other topics