mqtt_client 패키지는 장치와 서버 간 실시간 통신을 가능하게 하는 Dart 기반의 MQTT 클라이언트 구현체입니다. 표준, 보안(TLS), 웹소켓 연결을 지원하여 서버 측 및 브라우저 기반 애플리케이션 모두에 적합합니다. 크로스 플랫폼 사용을 위해 설계되어 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스에서 원활하게 작동합니다. IoT 프로젝트에 이상적이며, 낮은 지연과 높은 효율성으로 가벼운 발행-구독 메시징을 제공합니다.
사용 사례
사물인터넷 장치 통신
실시간 데이터 스트리밍
원격 센서 모니터링
스마트 홈 자동화
실시간 대시보드 업데이트
클라우드에서 디바이스로의 메시지 전달
주요 기능
TCP, TLS 및 WebSocket을 통한 MQTT 지원
크로스 플랫폼 호환성
경량이고 효율적
강력한 연결 처리
발행/구독 메시징 모델
자동 재연결
적합한 대상
사물인터넷 개발자
실시간 애플리케이션 빌더
발행/구독이 필요한 백엔드 서비스
웹 기반 대시보드
실시간 업데이트가 필요한 모바일 앱
고려 사항
적절한 브로커 설정이 필요합니다
안전한 연결을 위해 추가 구성이 필요할 수 있습니다
조정 없이 고주파, 저지연 시나리오에 적합하지 않음
외부 MQTT 브로커 사용 가능 여부에 따라 달라짐
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
mqtt_client
A server and browser based MQTT client for Dart.
The client is an MQTT v3(3.1 and 3.1.1) implementation(an equivalent MQTT v5 client can be found here) supporting subscription/publishing at all QOS levels,
keep alive and synchronous connection. The client is designed to take as much MQTT protocol work
off the user as possible, connection protocol is handled automatically as are the message exchanges needed
to support the different QOS levels and the keep alive mechanism. This allows the user to concentrate on
publishing/subscribing and not the details of MQTT itself.
Examples of usage can be found in the examples directory. An example is also provided
showing how to use the client to connect to the mqtt-bridge of Google's IoT-Core suite. This demonstrates
how to use secure connections and switch MQTT protocols. The test directory also contains standalone runnable scripts demonstrating subscription, publishing and topic filtering.
The server client supports both normal and secure TCP connections and secure(wss) and non-secure(ws) websocket connections.
The browser client supports only secure(wss) and non-secure(ws) websocket connections.
The client has been used successfully with the MQTT brokers from several of the major cloud providers IOT/MQTT
platforms, including :-
Google IOT Core
Amazon AWS
Microsoft Azure
IBM
It has also been used with a range of both publicly available brokers such as Mosquitto and proprietary ones.
An example using the adafruit MQTT broker for flutter can be found here.
The code is originally a port from the C# nMQTT client library to Dart.
Please read the changelog for details related to specific versions.
Installation
If you are using the client in a flutter environment on Android or iOS devices then the following device permission settings are necessary.
iOS
Add the following keys to your Info.plist file, located in ios/Runner/Info.plist:
<key>NSLocalNetworkUsageDescription</key>
<string>Looking for local tcp Bonjour service</string><key>NSBonjourServices</key><array><string>mqtt.tcp</string></array>
Android
Add the following Android permissions to the AndroidManifest.xml file, located in android/app/src/main/AndroidManifest.xml: