> 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/microservices/untitled-1.md).

# MQTT

MQTT

[MQTT](http://mqtt.org/)는 짧은 대기 시간에 최적화된 경량 메시징 프로토콜입니다.

## Installation

시작하기 전에 필요한 패키지를 설치해야합니다.

```bash
$ npm i --save mqtt
```

## Overview

**MQTT** 전송기로 전환하려면 `createMicroservice()`메소드에 전달된 옵션 객체를 수정해야 합니다.

```typescript
@@filename(main)
const app = await NestFactory.createMicroservice(ApplicationModule, {
  transport: Transport.MQTT,
  options: {
    host: 'localhost',
    port: 1883,
  },
});
```

> info **힌트** `전송` 열거자는 `@nestjs/microservices` 패키지에서 가져옵니다.

## Options

트랜스포트 동작을 결정하는 사용 가능한 옵션이 많이 있습니다. 그것들은 잘 설명되어 있습니다 [여기](https://github.com/mqttjs/MQTT.js).
