> For the complete documentation index, see [llms.txt](https://jakekwak.gitbook.io/nestjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jakekwak.gitbook.io/nestjs/websockets/pipes.md).

# Pipes

## Pipes

웹 소켓 **파이프**와 [일반 파이프](https://app.gitbook.com/pipes) 사이에는 차이가 없습니다. 알아야 할 유일한 것은 `HttpException`을 발생시키는 대신 `WsException`을 사용해야 한다는 것입니다. 게다가 모든 파이프는 `data` 매개 변수에만 적용됩니다 (클라이언트 인스턴스의 사운드를 확인하거나 변형하기 때문에 어색함).

> info **힌트** `WsException` 클래스는`@nestjs/websockets` 패키지에서 노출됩니다.

## Binding pipes

다음은 수동으로 인스턴스화 된 메소드 범위 파이프를 사용하는 예입니다 (클래스 범위도 작동 함).

```typescript
@@filename()
@UsePipes(new ValidationPipe())
@SubscribeMessage('events')
handleEvent(client: Client, data: unknown): WsResponse<unknown> {
  const event = 'events';
  return { event, data };
}
@@switch
@UsePipes(new ValidationPipe())
@SubscribeMessage('events')
handleEvent(client, data) {
  const event = 'events';
  return { event, data };
}
```
