Socket Decorator

Module
import { Socket } from "@tsed/socketio"
Source/packages/socketio/src/decorators/socket.ts

Overview

function Socket(target: any, propertyKey: string, index: number): any;

Description

Inject the Socket instance in the decorated parameter.

Example

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

  @Input("event")
  myMethod(@Socket socket) {

  }
}
1
2
3
4
5
6
7
8