MQTT

ansunny1170·2022년 11월 30일
0

MQTT 사용법 기능 용어 등 다양한 내용을 두서없이 작성할 포스팅입니다!

# docker-compose로 사용


User@:/home/mqtt# cat docker-compose.yaml
version: '3.3'
services:
  mqtt:
    image: eclipse-mosquitto
    volumes:
      - ./config:/mosquitto/config
      - ./ssl:/mosquitto/ssl
    tty: true
    stdin_open: true
    restart: always
    ports:
      - 컨테이너포트1:1883 # mqtt
      - 컨테이너포트2:8088 # ws

# wss 적용 방법


컨테이너(서버)를 따로 두고 mqtt 전용 서버로 사용합니다.

참고 : https://mosquitto.org/man/mosquitto-conf-5.html

protocol을 검색해서 어떤 값을 넣으면 되는지 봅니다.
그중 certfile, keyfile을 준비해 경로를 입력해주면 wss로만 사용 가능합니다.

ws/wss 동시에 사용하는 방법은.. 모르겠습니다.

사용한 mqtt는 mosquitto입니다.
image: eclipse-mosquitto

(생략...)

# listener port-number [ip address/host name/unix socket path]
#listener
listener 1883
listener 8088
protocol websockets

# 아래 파일 유무에 따라 ws/wss 사용가능 
#certfile
certfile /mosquitto/ssl/ssl-flexing.crt
# Path to the PEM encoded keyfile.
keyfile /mosquitto/ssl/flexing.ai.key
# Both of certfile and keyfile must be defined to enable certificate based

(중략...)

allow_anonymous true

(생략...)
profile
공정 설비 개발/연구원에서 웹 서비스 개발자로 경력 이전하였습니다. Node.js 백엔드 기반 풀스택 개발자를 목표로 하고 있습니다.

0개의 댓글