Pipes
There is no difference between web sockets pipes and the regular pipes. The only thing you should be aware of is that instead of throwing HttpException, you should use the WsException. Besides, all pipes will be applied only to the data parameter.
Hint TheWsExceptionclass is exposed from@nestjs/websocketspackage.
Binding pipes
Here is an example that makes use of a manually instantiated method-scoped pipe (class-scoped works either):
TypeScript
@UsePipes(new ValidationPipe())
@SubscribeMessage('events')
onEvent(client, data: any): WsResponse<any> {
const event = 'events';
return { event, data };
}