# Decorator InputAndBroadcast

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

# Overview

function InputAndBroadcast(eventName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;

# Description

Attach the decorated method to the socket event and broadcast the response to all clients.

# Example

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

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

Other topics