Skip to content

InputAndBroadcastOthers

@tsed/socketio

Usage

typescript
import { InputAndBroadcastOthers } from "@tsed/socketio";

See /packages/third-parties/socketio/src/types/decorators/inputAndBroadcastOthers.ts.

Overview

ts
function InputAndBroadcastOthers(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 with the exception of the connected customer.

Example

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

  @InputAndBroadcastOthers("event")
  async myMethod(@Args(0) data: any, @Nsp socket) {
     return {data: "data"};
  }
}

Released under the MIT License.