MQTT

MQTT

MQTTλŠ” 짧은 λŒ€κΈ° μ‹œκ°„μ— μ΅œμ ν™”λœ κ²½λŸ‰ λ©”μ‹œμ§• ν”„λ‘œν† μ½œμž…λ‹ˆλ‹€.

Installation

μ‹œμž‘ν•˜κΈ° 전에 ν•„μš”ν•œ νŒ¨ν‚€μ§€λ₯Ό μ„€μΉ˜ν•΄μ•Όν•©λ‹ˆλ‹€.

$ npm i --save mqtt

Overview

MQTT μ „μ†‘κΈ°λ‘œ μ „ν™˜ν•˜λ €λ©΄ createMicroservice()λ©”μ†Œλ“œμ— μ „λ‹¬λœ μ˜΅μ…˜ 객체λ₯Ό μˆ˜μ •ν•΄μ•Ό ν•©λ‹ˆλ‹€.

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

info 힌트 전솑 μ—΄κ±°μžλŠ” @nestjs/microservices νŒ¨ν‚€μ§€μ—μ„œ κ°€μ Έμ˜΅λ‹ˆλ‹€.

Options

트랜슀포트 λ™μž‘μ„ κ²°μ •ν•˜λŠ” μ‚¬μš© κ°€λŠ₯ν•œ μ˜΅μ…˜μ΄ 많이 μžˆμŠ΅λ‹ˆλ‹€. 그것듀은 잘 μ„€λͺ…λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€ μ—¬κΈ°.

Last updated