# 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
2
3
4
5
6
7
8
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing