Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- DatePicker
- transfer
- 서버동기화
- 공인IP
- AntDesign
- setInterval 외부 정지
- invalid data
- 1883
- c# datagridview 데이터 넣기
- mySQL_Replication
- setInterval 중지
- pm2
- pm2 확인
- DataGridView 직접 입력
- Replication
- map이 undefined가 뜰 때
- listener 1883
- mosquitto.conf
- setInterval 정지
- timepicker
- pm2 상태 확인
- 데이터테이블 데이터 넣기
- pm2 시작
- 맥 어드레스
- mosquitto
- datagridview 직접입력
- allow_anonymouse
- pm2 설치
- html #select #option #multiple
- setInterval clear
Archives
- Today
- Total
개발 노트
NodeJS로 MQTT 연결 본문
const mqtt = require('mqtt')
const options = {
host: 호스트번호,
port: 포트번호,
protocol: 'mqtt',
};
const client = mqtt.connect(options);
client.on("connect", () => {
console.log("connected" + client.connected);
})
client.on("error", (error) => {
console.log("Can't connect" + error);
process.exit(1)
});
const topic_s="#";
client.subscribe(topic_s, {qos:1});
client.on('message', (topic, message, packet) => {
let obj = JSON.parse(message);
console.log(obj.CMD);
});
'TIL' 카테고리의 다른 글
기존 작업물에서 새로운 페이지 만들 때 (0) | 2023.09.25 |
---|---|
MQTT (0) | 2023.09.14 |
파레토 법칙 (0) | 2023.08.30 |