IOT

MQTT-1

@서비 2021. 12. 29. 09:23

 

 

오늘은 IOT 통신의 기반이 되는 MQTT 통신을 해 본다.

우선 프로그램을 다운로드하여야 한다. 사용할 프로그램은 mosquitto mqtt 이다.

 

1. 설치

https://mosquitto.org/download/

 

Download

Mosquitto Enhancements These projects can be used to add extra features to Mosquitto. Management Center: A web UI for managing Mosquitto instances. In particular, this offers a convenient UI for managing clients, groups and roles as in the new Dynamic Secu

mosquitto.org

 

 

 

2. 실행

mqtt 통신은 broker subscriber publisher 가 있는데 broker는 중계만 한고 publisher 가 정보를 publish 하고 Subscriber 가 정보를 구독하고 있다가 전달받는다.

 

기본 명령어는 아래와 같다.

 

■ mosquitto broker 실행

mosquitto -v

 

■ mosquitto Subscriber 실행

 

mosquitto_sub -h localhost -t /test

 

■ mosquitto Publisher실행


mosquitto_pub -h localhost -t /test -m "Hello"