MQTT 사용법 기능 용어 등 다양한 내용을 두서없이 작성할 포스팅입니다!
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
컨테이너(서버)를 따로 두고 mqtt 전용 서버로 사용합니다.
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
(생략...)