# 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 };
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jakekwak.gitbook.io/nestjs/websockets/pipes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
