├── .github └── workflows │ └── issue-translator.yaml ├── .gitignore ├── LICENSE ├── README.md ├── assets └── emqx-architecture.png ├── mqtt-client-Android-Kotlin ├── .gitignore ├── .gitkeep ├── README.md ├── README_ZH.md ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── io │ │ │ └── emqx │ │ │ └── mqtt │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── io │ │ │ │ └── emqx │ │ │ │ └── mqtt │ │ │ │ ├── BaseFragment.kt │ │ │ │ ├── Connection.kt │ │ │ │ ├── ConnectionFragment.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── Message.kt │ │ │ │ ├── MessageFragment.kt │ │ │ │ ├── MessageRecyclerViewAdapter.kt │ │ │ │ ├── Publish.kt │ │ │ │ ├── PublishFragment.kt │ │ │ │ ├── PublishRecyclerViewAdapter.kt │ │ │ │ ├── SSLUtils.kt │ │ │ │ ├── SectionsPagerAdapter.kt │ │ │ │ ├── Subscription.kt │ │ │ │ ├── SubscriptionFragment.kt │ │ │ │ └── SubscriptionRecyclerViewAdapter.kt │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── fragment_connection.xml │ │ │ ├── fragment_main.xml │ │ │ ├── fragment_message_list.xml │ │ │ ├── fragment_publish_list.xml │ │ │ ├── fragment_subscription_list.xml │ │ │ ├── item_message.xml │ │ │ ├── item_publish.xml │ │ │ └── item_subscription.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── raw │ │ │ └── cacert.pem │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── themes.xml │ │ │ └── xml │ │ │ ├── backup_rules.xml │ │ │ └── data_extraction_rules.xml │ │ └── test │ │ └── java │ │ └── io │ │ └── emqx │ │ └── mqtt │ │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── mqtt-client-Android ├── .gitignore ├── .gitkeep ├── README.md ├── README_ZH.md ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── io │ │ │ └── emqx │ │ │ └── mqtt │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ │ └── ca.crt │ │ ├── java │ │ │ └── io │ │ │ │ └── emqx │ │ │ │ └── mqtt │ │ │ │ ├── BaseFragment.java │ │ │ │ ├── Connection.java │ │ │ │ ├── ConnectionFragment.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── Message.java │ │ │ │ ├── MessageFragment.java │ │ │ │ ├── MessageRecyclerViewAdapter.java │ │ │ │ ├── Publish.java │ │ │ │ ├── PublishFragment.java │ │ │ │ ├── PublishRecyclerViewAdapter.java │ │ │ │ ├── SSLUtils.java │ │ │ │ ├── SectionsPagerAdapter.java │ │ │ │ ├── Subscription.java │ │ │ │ ├── SubscriptionFragment.java │ │ │ │ └── SubscriptionRecyclerViewAdapter.java │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── fragment_connection.xml │ │ │ ├── fragment_main.xml │ │ │ ├── fragment_message_list.xml │ │ │ ├── fragment_publish_list.xml │ │ │ ├── fragment_subscription_list.xml │ │ │ ├── item_message.xml │ │ │ ├── item_publish.xml │ │ │ └── item_subscription.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── raw │ │ │ └── cacert.pem │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── io │ │ └── emqx │ │ └── mqtt │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── mqtt-client-Angular.js ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── Angular17 │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app.component.html │ │ │ ├── app.component.scss │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ └── app.module.ts │ │ ├── assets │ │ │ └── .gitkeep │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.scss │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── yarn.lock ├── README.md ├── angular.json ├── karma.conf.js ├── package.json ├── src │ ├── app │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ └── app.module.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── yarn.lock ├── mqtt-client-C-RT-Thread ├── .gitignore ├── README.md ├── applications │ ├── main.c │ ├── mqtt_client.c │ └── mqtt_client.h └── snapshots │ ├── b7f3e53a4f6a789c698e5af8476d3e51.png │ ├── image-20210812042014559.png │ ├── image-20210812042139878.png │ ├── image-20210812042248923.png │ ├── image-20210812043357450.png │ ├── image-20210812044015699.png │ ├── image-20210812113252985.png │ ├── image-20210812160131240.png │ ├── image-20210812164508979.png │ ├── image-20210812165116098.png │ ├── image-20210812173557767.png │ ├── image-20210813120217206.png │ ├── image-20210813120347932.png │ ├── image-20210813132147494.png │ ├── image-20210813133146242.png │ ├── image-20210813142338622.png │ ├── image-20210813142515940.png │ ├── image-20210813142846510.png │ ├── image-20210813142918921.png │ ├── image-20210814171042277.png │ ├── image-20210814172412786.png │ ├── image-20210814181317020.png │ └── wechat_20210812163029.png ├── mqtt-client-C-nng ├── .clang-format ├── .gitignore ├── CMakeLists.txt ├── README.md ├── README_ZH.md └── mqtt_async.c ├── mqtt-client-C-paho ├── CMakeLists.txt ├── README.md ├── README_ZH.md ├── emqx_file_transfer.c ├── main.c └── main_tls.c ├── mqtt-client-Csharp-MqttNet ├── .gitignore ├── README.md ├── pub-sub-tcp │ ├── Program.cs │ ├── pub-sub-tcp.csproj │ └── pub-sub-tcp.sln └── pub-sub-tls │ ├── Program.cs │ ├── broker.emqx.io-ca.crt │ ├── pub-sub-tls.csproj │ └── pub-sub-tls.sln ├── mqtt-client-Csharp ├── MqttNetTLSClient │ ├── Client.cs │ ├── MqttNetClient.csproj │ ├── Program.cs │ └── obj │ │ ├── MqttNetClient.csproj.nuget.dgspec.json │ │ ├── MqttNetClient.csproj.nuget.g.props │ │ ├── MqttNetClient.csproj.nuget.g.targets │ │ └── project.assets.json ├── README.md ├── README_ZH.md ├── publish │ ├── Program.cs │ └── publish.csproj └── subscribe │ ├── Program.cs │ └── subscribe.csproj ├── mqtt-client-Django ├── django_mqtt │ ├── __init__.py │ ├── asgi.py │ ├── mqtt.py │ ├── settings.py │ ├── urls.py │ ├── views.py │ └── wsgi.py └── manage.py ├── mqtt-client-ESP32 ├── README.md ├── README_ZH.md ├── broker.emqx.io-ca.crt ├── emqxsl-ca.crt ├── esp32_DS18B20_sensor_via_tls.ino ├── esp32_DS18B20_temp_chart │ ├── .gitignore │ ├── README.md │ ├── README_ZH.md │ ├── _assets │ │ ├── esp32.png │ │ ├── fly.png │ │ └── webui.png │ ├── esp32 │ │ ├── README.md │ │ ├── README_ZH.md │ │ └── water_temperature_sensor.ino │ └── web │ │ ├── .dockerignore │ │ ├── Dockerfile │ │ ├── FLY_README.md │ │ ├── README.md │ │ ├── README_ZH.md │ │ ├── __init__.py │ │ ├── app.py │ │ ├── certs │ │ ├── broker.emqx.io-ca.crt │ │ └── emqxsl-ca.crt │ │ ├── fly.toml │ │ ├── requirements.txt │ │ └── templates │ │ └── chart.html ├── esp32_connect_mqtt.ino.ino ├── esp32_connect_mqtt_via_tls.ino └── esp32_soil_moisture_sensor_via_tls.ino ├── mqtt-client-ESP8266 ├── README.md ├── README_ZH.md ├── broker.emqx.io-ca.crt ├── emqxsl-ca.crt ├── esp8266_connect_mqtt_via_tls.ino ├── esp_connect_mqtt.ino ├── esp_mqtt_led.ino ├── esp_mqtt_moisture.ino └── temp_hum.ino ├── mqtt-client-Electron ├── .gitignore ├── README.md ├── index.html ├── main.css ├── main.js ├── package-lock.json ├── package.json ├── preload.js └── renderer.js ├── mqtt-client-Elixir ├── .tool-versions ├── README.md ├── README_ZH.md ├── mqtt.exs └── mqtt_tls.exs ├── mqtt-client-Erlang ├── .gitignore ├── LICENSE ├── README.md ├── README_ZH.md ├── certs │ ├── README │ ├── cacert.pem │ ├── client-cert.pem │ └── client-key.pem ├── rebar.config └── src │ ├── mqttex.app.src │ ├── mqttex.erl │ ├── mqttex_app.erl │ └── mqttex_sup.erl ├── mqtt-client-Flask ├── .gitignore ├── README.md ├── README_ZH.md ├── certs │ ├── broker.emqx.io-ca.crt │ └── emqxsl-ca.crt ├── flask_mqtt_app.py ├── flask_mqtt_app_via_tls.py └── requirements.txt ├── mqtt-client-Flutter ├── .gitignore ├── .gitkeep ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── io │ │ │ │ │ └── emqx │ │ │ │ │ └── flutter_mqtt │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── certs │ │ ├── client.crt │ │ ├── client.key │ │ └── server-ca.crt ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── main.dart │ └── mqtt_client.dart ├── pubspec.lock ├── pubspec.yaml ├── test │ └── widget_test.dart └── web │ ├── favicon.png │ ├── icons │ ├── Icon-192.png │ └── Icon-512.png │ ├── index.html │ └── manifest.json ├── mqtt-client-Go ├── README.md ├── README_ZH.md ├── file-transfer │ ├── README.md │ ├── go.mod │ ├── go.sum │ └── main.go ├── one_way-tls │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── server.sh ├── pubsub │ ├── README.md │ ├── README_ZH.md │ ├── broker.emqx.io-ca.crt │ ├── cn.emqx.cloud-ca.crt │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── protocols │ │ ├── actions.go │ │ ├── config.go │ │ ├── connections.go │ │ ├── global_var.go │ │ ├── use_ssl.go │ │ ├── use_tcp.go │ │ ├── use_ws.go │ │ └── use_wss.go │ └── test │ │ └── mqttTest.go └── two_way-tls │ ├── README.md │ ├── client.sh │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── server.sh ├── mqtt-client-Java ├── .gitignore ├── .gitkeep ├── README.md ├── README_ZH.md ├── pom.xml └── src │ └── main │ ├── java │ └── io │ │ └── emqx │ │ └── mqtt │ │ ├── MqttExample.java │ │ ├── MqttFileTransferSample.java │ │ ├── MqttOneWayTlsSample.java │ │ ├── MqttSample.java │ │ ├── MqttTwoWayTlsSample.java │ │ ├── PublishSample.java │ │ ├── SSLUtils.java │ │ ├── SampleCallback.java │ │ └── SubscribeSample.java │ └── resources │ └── io │ └── emqx │ └── mqtt │ └── broker.emqx.io-ca.crt ├── mqtt-client-JavaScript ├── .gitignore ├── README.md ├── mqtt-client-tls-two-way.js ├── mqtt-client-tls.js └── mqtt-client.js ├── mqtt-client-Micropython ├── README.md ├── README_ZH.md ├── v1.22_and_earlier │ ├── pub.py │ ├── pub_sub_tcp.py │ ├── pub_sub_tls.py │ ├── sub.py │ └── wifi.py └── v1.23_and_above │ ├── certs │ ├── broker.emqx.io-ca.crt │ ├── broker.emqx.io-ca.der │ ├── emqx-dedicated-ca.crt │ ├── emqx-dedicated-ca.der │ ├── emqxsl-ca.crt │ └── emqxsl-ca.der │ ├── pub.py │ ├── pub_sub_tcp.py │ ├── pub_sub_tls.py │ ├── pub_sub_tls_no_secure.py │ ├── sub.py │ └── wifi.py ├── mqtt-client-Node.js ├── .gitignore ├── README.md ├── README_ZH.md ├── broker.emqx.io-ca.crt ├── emqx-file-transfer.js ├── index-tls-two-way.js ├── index-tls.js ├── index.js ├── package.json ├── use_mqtt.js ├── use_mqtts.js ├── use_ws.js ├── use_wss.js └── yarn.lock ├── mqtt-client-PHP ├── .gitignore ├── README.md ├── README_ZH.md ├── composer.json ├── composer.lock ├── phpMQTT_pubsub.php ├── pubsub_tcp.php ├── pubsub_tls.php └── simps_pubsub.php ├── mqtt-client-Python3 ├── .gitignore ├── README.md ├── README_ZH.md ├── broker.emqx.io-ca.crt ├── file_transfer.py ├── pub_sub_tcp.py ├── pub_sub_tcp_v5.py ├── pub_sub_tls.py ├── pub_sub_two_way_tls.py ├── pub_sub_ws.py ├── pub_sub_wss.py ├── pub_tcp.py ├── pub_tcp_v5.py ├── pub_tls.py ├── pub_ws.py ├── pub_wss.py ├── sub_msg_to_sqlite.py ├── sub_tcp.py ├── sub_tcp_v5.py ├── sub_tls.py ├── sub_ws.py └── sub_wss.py ├── mqtt-client-Qt ├── README.md ├── client.pro └── example.cpp ├── mqtt-client-React-Native-Expo ├── .gitignore ├── README.md ├── app.json ├── app │ ├── (tabs) │ │ ├── _layout.tsx │ │ └── index.tsx │ ├── +html.tsx │ ├── +not-found.tsx │ └── _layout.tsx ├── assets │ ├── fonts │ │ └── SpaceMono-Regular.ttf │ └── images │ │ ├── adaptive-icon.png │ │ ├── favicon.png │ │ ├── icon.png │ │ └── splash.png ├── babel.config.js ├── components │ ├── ThemedText.tsx │ └── ThemedView.tsx ├── constants │ └── Colors.ts ├── hooks │ ├── useColorScheme.ts │ ├── useColorScheme.web.ts │ └── useThemeColor.ts ├── package-lock.json ├── package.json ├── scripts │ └── reset-project.js └── tsconfig.json ├── mqtt-client-React-Native ├── README.md └── RNMQTTDemo │ ├── .buckconfig │ ├── .bundle │ └── config │ ├── .eslintrc.js │ ├── .flowconfig │ ├── .gitignore │ ├── .prettierrc.js │ ├── .ruby-version │ ├── .watchmanconfig │ ├── App.js │ ├── Gemfile │ ├── Gemfile.lock │ ├── __tests__ │ └── App-test.js │ ├── android │ ├── app │ │ ├── _BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── rnmqttdemo │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── rnmqttdemo │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MainApplication.java │ │ │ │ └── newarchitecture │ │ │ │ ├── MainApplicationReactNativeHost.java │ │ │ │ ├── components │ │ │ │ └── MainComponentsRegistry.java │ │ │ │ └── modules │ │ │ │ └── MainApplicationTurboModuleManagerDelegate.java │ │ │ ├── jni │ │ │ ├── Android.mk │ │ │ ├── MainApplicationModuleProvider.cpp │ │ │ ├── MainApplicationModuleProvider.h │ │ │ ├── MainApplicationTurboModuleManagerDelegate.cpp │ │ │ ├── MainApplicationTurboModuleManagerDelegate.h │ │ │ ├── MainComponentsRegistry.cpp │ │ │ ├── MainComponentsRegistry.h │ │ │ └── OnLoad.cpp │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle │ ├── app.json │ ├── babel.config.js │ ├── index.js │ ├── ios │ ├── Podfile │ ├── Podfile.lock │ ├── RNMQTTDemo.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── RNMQTTDemo.xcscheme │ ├── RNMQTTDemo.xcworkspace │ │ └── contents.xcworkspacedata │ ├── RNMQTTDemo │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ └── RNMQTTDemoTests │ │ ├── Info.plist │ │ └── RNMQTTDemoTests.m │ ├── metro.config.js │ ├── package-lock.json │ └── package.json ├── mqtt-client-React ├── .gitignore ├── README.md ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── components │ │ ├── Class │ │ │ ├── Connection.js │ │ │ ├── Publisher.js │ │ │ ├── Receiver.js │ │ │ ├── Subscriber.js │ │ │ └── index.js │ │ └── Hook │ │ │ ├── Connection.js │ │ │ ├── Publisher.js │ │ │ ├── Receiver.js │ │ │ ├── Subscriber.js │ │ │ └── index.js │ ├── index.css │ ├── index.js │ ├── serviceWorker.js │ └── setupTests.js └── yarn.lock ├── mqtt-client-SpringBoot └── .gitkeep ├── mqtt-client-Vue.js ├── .browserslistrc ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── README.md ├── babel.config.js ├── package.json ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── App.vue │ ├── assets │ │ └── style │ │ │ └── home.scss │ ├── main.js │ └── views │ │ └── Home.vue └── yarn.lock ├── mqtt-client-Vue3.js ├── .gitignore ├── README.md ├── env.d.ts ├── index.html ├── package-lock.json ├── package.json ├── public │ └── favicon.ico ├── shims-mqtt.d.ts ├── src │ ├── App.vue │ ├── components │ │ └── MqttDemo.vue │ └── main.ts ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts ├── mqtt-client-WebSocket ├── README.md └── ws-mqtt.html ├── mqtt-client-swift ├── .gitignore ├── .swiftpm │ └── xcode │ │ └── package.xcworkspace │ │ └── contents.xcworkspacedata ├── .travis.yml ├── Cartfile ├── CocoaMQTT.podspec ├── CocoaMQTT.xcodeproj │ ├── Example.xcworkspace │ │ └── contents.xcworkspacedata │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ ├── Mac Framework.xcscheme │ │ ├── iOS Framework.xcscheme │ │ └── tvOS Framework.xcscheme ├── CocoaMQTTTests │ ├── CocoaMQTTDeliverTests.swift │ ├── CocoaMQTTStorageTests.swift │ ├── CocoaMQTTTests.swift │ ├── FrameTests.swift │ ├── Info.plist │ └── client-keycert.p12 ├── Example │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Example │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Double Down Green.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Double Down.png │ │ │ ├── Double Down.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Double Down-100.png │ │ │ ├── Down-green.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Down-green.png │ │ │ ├── Down.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Down.png │ │ │ ├── Horse.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Horse100.png │ │ │ ├── Pig.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Pig100.png │ │ │ ├── Sheep.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── Sheep100.png │ │ │ ├── animals.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── animals.jpg │ │ │ ├── left_message_back.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── chatfrom_bg_normal.png │ │ │ ├── other.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── other.jpg │ │ │ ├── right_message_back.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── chatto_bg_normal.png │ │ │ ├── tabHorse.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── Horse.png │ │ │ │ ├── Horse@2x.png │ │ │ │ └── Horse@3x.png │ │ │ ├── tabPig.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── Pig1.png │ │ │ │ ├── Pig1@2x.png │ │ │ │ └── Pig1@3x.png │ │ │ └── tabSheep.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── Sheep.png │ │ │ │ ├── Sheep@2x.png │ │ │ │ └── Sheep@3x.png │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── ChatLeftMessageCell.swift │ │ ├── ChatMessage.swift │ │ ├── ChatRightMessageCell.swift │ │ ├── ChatViewController.swift │ │ ├── Info.plist │ │ ├── ViewController.swift │ │ └── client-keycert.p12 │ └── Podfile ├── LICENSE ├── Package.resolved ├── Package.swift ├── Podfile ├── README.md ├── Source │ ├── CocoaMQTT.h │ ├── CocoaMQTT.swift │ ├── CocoaMQTT5.swift │ ├── CocoaMQTT5Message.swift │ ├── CocoaMQTTDeliver.swift │ ├── CocoaMQTTLogger.swift │ ├── CocoaMQTTMessage.swift │ ├── CocoaMQTTProperty.swift │ ├── CocoaMQTTReader.swift │ ├── CocoaMQTTReasonCode.swift │ ├── CocoaMQTTSocket.swift │ ├── CocoaMQTTStorage.swift │ ├── CocoaMQTTTimer.swift │ ├── CocoaMQTTTypes.swift │ ├── CocoaMQTTWebSocket.swift │ ├── Frame.swift │ ├── FrameAuth.swift │ ├── FrameConnAck.swift │ ├── FrameConnect.swift │ ├── FrameDisconnect.swift │ ├── FramePingReq.swift │ ├── FramePingResp.swift │ ├── FramePubAck.swift │ ├── FramePubComp.swift │ ├── FramePubRec.swift │ ├── FramePubRel.swift │ ├── FramePublish.swift │ ├── FrameSubAck.swift │ ├── FrameSubscribe.swift │ ├── FrameUnsubAck.swift │ ├── FrameUnsubscribe.swift │ ├── Info.plist │ ├── MqttAuthProperties.swift │ ├── MqttConnectProperties.swift │ ├── MqttDecodeConnAck.swift │ ├── MqttDecodePubAck.swift │ ├── MqttDecodePubComp.swift │ ├── MqttDecodePubRec.swift │ ├── MqttDecodePubRel.swift │ ├── MqttDecodePublish.swift │ ├── MqttDecodeSubAck.swift │ ├── MqttDecodeUnsubAck.swift │ ├── MqttPublishProperties.swift │ └── MqttSubscription.swift ├── coveralls.sh ├── edl-v10 └── epl-v10 ├── mqtt-client-wechat-miniprogram ├── .eslintrc.js ├── README.md ├── app.js ├── app.json ├── app.wxss ├── mqtt.png ├── pages │ ├── index │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ └── logs │ │ ├── logs.js │ │ ├── logs.json │ │ ├── logs.wxml │ │ └── logs.wxss ├── project.config.json ├── project.private.config.json ├── sitemap.json └── utils │ ├── mqtt.min.js │ └── util.js └── paho.mqtt.android-kotlin ├── README.md ├── basicSample ├── build.gradle └── src │ ├── androidTest │ └── java │ │ └── info │ │ └── mqtt │ │ └── java │ │ └── example │ │ └── ConnectTest.kt │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── info │ │ └── mqtt │ │ └── java │ │ └── example │ │ ├── HistoryAdapter.kt │ │ └── MQTTExampleActivity.kt │ └── res │ ├── layout │ ├── activity_scrolling.xml │ └── history_row.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── extendedSample ├── build.gradle ├── schemas │ └── info.mqtt.android.extsample.room.AppDatabase │ │ └── 1.json └── src │ ├── androidTest │ └── java │ │ └── info │ │ └── mqtt │ │ └── android │ │ └── extsample │ │ └── activity │ │ ├── ExtendedMainTest.kt │ │ ├── ExtendedPublishTest.kt │ │ └── Matchers.kt │ └── main │ ├── AndroidManifest.xml │ ├── ic_launcher-web.png │ ├── java │ └── info │ │ └── mqtt │ │ └── android │ │ └── extsample │ │ ├── ActivityConstants.kt │ │ ├── MainActivity.kt │ │ ├── StrictApplication.kt │ │ ├── adapter │ │ ├── HistoryListItemAdapter.kt │ │ ├── MessageListItemAdapter.kt │ │ ├── NavigationDrawerAdapter.kt │ │ └── SubscriptionListItemAdapter.kt │ │ ├── fragments │ │ ├── ConnectionFragment.kt │ │ ├── DrawerFragment.kt │ │ ├── EditConnectionFragment.kt │ │ ├── HistoryFragment.kt │ │ ├── HomeFragment.kt │ │ ├── ManageConnectionFragment.kt │ │ ├── MessagesFragment.kt │ │ ├── PublishFragment.kt │ │ └── SubscriptionFragment.kt │ │ ├── internal │ │ ├── Action.kt │ │ ├── ActionListener.kt │ │ ├── Connection.kt │ │ ├── Connections.kt │ │ ├── MqttCallbackHandler.kt │ │ ├── MqttTraceCallback.kt │ │ └── Notify.kt │ │ ├── model │ │ ├── ConnectionModel.kt │ │ ├── NavDrawerItem.kt │ │ ├── ReceivedMessage.kt │ │ └── Subscription.kt │ │ ├── room │ │ ├── AppDatabase.kt │ │ ├── Converters.kt │ │ ├── PersistenceDao.kt │ │ ├── SubscriptionDao.kt │ │ └── entity │ │ │ ├── ConnectionEntity.kt │ │ │ └── SubscriptionEntity.kt │ │ └── utils │ │ ├── ConnectionUtils.kt │ │ └── SubscriptionUtils.kt │ └── res │ ├── drawable-hdpi │ ├── ic_add.png │ ├── ic_cloud_done_dark.png │ ├── ic_cloud_off_dark.png │ ├── ic_delete.png │ ├── ic_done.png │ ├── ic_help.png │ └── ic_topic.png │ ├── drawable-mdpi │ ├── ic_add.png │ ├── ic_cloud_done_dark.png │ ├── ic_cloud_off_dark.png │ ├── ic_delete.png │ ├── ic_done.png │ ├── ic_help.png │ └── ic_topic.png │ ├── drawable-xhdpi │ ├── ic_add.png │ ├── ic_cloud_done_dark.png │ ├── ic_cloud_off_dark.png │ ├── ic_delete.png │ ├── ic_done.png │ ├── ic_help.png │ ├── ic_logcat.png │ └── ic_topic.png │ ├── drawable-xxhdpi │ ├── ic_add.png │ ├── ic_cloud_done_dark.png │ ├── ic_cloud_off_dark.png │ ├── ic_delete.png │ ├── ic_done.png │ ├── ic_help.png │ └── ic_topic.png │ ├── drawable │ └── paho_logo_full.png │ ├── layout │ ├── activity_main.xml │ ├── fragment_connection.xml │ ├── fragment_connection_history.xml │ ├── fragment_edit_connection.xml │ ├── fragment_home.xml │ ├── fragment_manage.xml │ ├── fragment_navigation_drawer.xml │ ├── fragment_publish.xml │ ├── fragment_subscriptions.xml │ ├── message_list_item.xml │ ├── nav_drawer_row.xml │ ├── subscription_dialog.xml │ ├── subscription_list_item.xml │ ├── switch_layout.xml │ ├── tab_layout.xml │ ├── text_input_dialog.xml │ ├── text_select.xml │ └── toolbar.xml │ ├── menu │ ├── menu_connection.xml │ ├── menu_edit_connection.xml │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── integers.xml │ ├── strings.xml │ ├── styles.xml │ └── text_select_values.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── serviceLibrary ├── build.gradle ├── schemas │ └── info.mqtt.android.service.room.MqMessageDatabase │ │ └── 1.json └── src │ ├── androidTest │ ├── AndroidManifest.xml │ ├── assets │ │ ├── test.bks │ │ ├── test.properties │ │ └── updatingCertificates.md │ └── java │ │ └── info │ │ └── mqtt │ │ └── android │ │ ├── AndroidServiceTest.kt │ │ ├── AndroidServiceWithActionListenerTest.kt │ │ ├── MqttReceiver.kt │ │ └── TestProperties.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── info │ │ │ └── mqtt │ │ │ └── android │ │ │ └── service │ │ │ ├── Ack.kt │ │ │ ├── MqttAndroidClient.kt │ │ │ ├── MqttConnectTokenAndroid.kt │ │ │ ├── MqttConnection.kt │ │ │ ├── MqttDeliveryTokenAndroid.kt │ │ │ ├── MqttService.kt │ │ │ ├── MqttServiceBinder.kt │ │ │ ├── MqttServiceConstants.kt │ │ │ ├── MqttTokenAndroid.kt │ │ │ ├── MqttTraceHandler.kt │ │ │ ├── ParcelableMqttMessage.kt │ │ │ ├── QoS.kt │ │ │ ├── Status.kt │ │ │ ├── ping │ │ │ └── AlarmPingSender.kt │ │ │ └── room │ │ │ ├── Converters.kt │ │ │ ├── MqMessageDao.kt │ │ │ ├── MqMessageDatabase.kt │ │ │ └── entity │ │ │ └── MqMessageEntity.kt │ └── res │ │ └── values │ │ └── strings.xml │ └── proguard-sdk.pro ├── settings.gradle └── test └── tls-testing ├── Dockerfile ├── keys ├── all-ca.crt ├── server │ ├── server-mitm.crt │ ├── server-mitm.key │ ├── server.crt │ └── server.key ├── test-root-ca.crt └── test-signing-ca.crt ├── mosquitto-docker.conf ├── mosquitto.conf └── mosquitto.pw /.github/workflows/issue-translator.yaml: -------------------------------------------------------------------------------- 1 | name: Translate Issue from Chinese to English 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | issue_number: 7 | description: 'The issue number to translate' 8 | required: true 9 | type: string 10 | issues: 11 | types: [opened] 12 | 13 | jobs: 14 | translate: 15 | runs-on: ubuntu-latest 16 | permissions: 17 | issues: write # Grant permission to edit issues 18 | steps: 19 | - uses: emqx/translate-issue-action@f63fa743df6f60643e6bd13322e73e4bd7b1c678 # v1.0.3 20 | with: 21 | issue_number: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.issue_number || github.event.issue.number }} 22 | gemini_api_key: ${{ secrets.GEMINI_API_KEY }} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea/ 3 | .vscode 4 | .venv 5 | .metadata 6 | *.zip 7 | env.* 8 | env 9 | .pyc -------------------------------------------------------------------------------- /assets/emqx-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/assets/emqx-architecture.png -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/README.md: -------------------------------------------------------------------------------- 1 | # Android MQTT Client Examples 2 | 3 | ## Prerequisites 4 | 5 | - Programing Language: [Kotlin](https://kotlinlang.org/) 6 | - IDE: Android Studio 7 | 8 | ## Libraries 9 | 10 | - [Eclipse Paho Java Client](https://github.com/eclipse/paho.mqtt.java) 11 | - [Eclipse Paho Android Service](https://github.com/eclipse/paho.mqtt.android) 12 | 13 | ## Run 14 | 15 | Open the project in Android Studio, connect the virtual machine or device, and run -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/README_ZH.md: -------------------------------------------------------------------------------- 1 | # Android 连接 MQTT 示例 2 | 3 | ## 准备 4 | 5 | - 编程语言: [Kotlin](https://kotlinlang.org/) 6 | - 开发工具: Android Studio 7 | 8 | ## 依赖库 9 | 10 | - [Eclipse Paho Java Client](https://github.com/eclipse/paho.mqtt.java) 11 | - [Eclipse Paho Android Service](https://github.com/eclipse/paho.mqtt.android) 12 | 13 | ## 运行 14 | 15 | 在 Android Studio 中打开项目,连接虚拟机或设备,运行 16 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/java/io/emqx/mqtt/Message.kt: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt 2 | 3 | import org.eclipse.paho.client.mqttv3.MqttMessage 4 | 5 | class Message(var topic: String, var message: MqttMessage) -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/java/io/emqx/mqtt/Publish.kt: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt 2 | 3 | class Publish(var topic: String, var payload: String, var qos: Int, var isRetained: Boolean) -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/java/io/emqx/mqtt/Subscription.kt: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt 2 | 3 | class Subscription(var topic: String, var qos: Int) -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/layout/fragment_message_list.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/layout/item_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | #6200EE 11 | #3700B3 12 | #03DAC5 13 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 16dp 7 | 8dp 8 | 16dp 9 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/app/src/test/java/io/emqx/mqtt/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | plugins { 3 | id 'com.android.application' version '7.2.2' apply false 4 | id 'com.android.library' version '7.2.2' apply false 5 | id 'org.jetbrains.kotlin.android' version '1.7.10' apply false 6 | } 7 | 8 | task clean(type: Delete) { 9 | delete rootProject.buildDir 10 | } -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android-Kotlin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Aug 15 09:48:05 CST 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /mqtt-client-Android-Kotlin/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | rootProject.name = "Mqtt Example" 16 | include ':app' 17 | -------------------------------------------------------------------------------- /mqtt-client-Android/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/ 38 | 39 | # Keystore files 40 | *.jks -------------------------------------------------------------------------------- /mqtt-client-Android/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-Android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/java/io/emqx/mqtt/Message.java: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt; 2 | 3 | import org.eclipse.paho.client.mqttv3.MqttMessage; 4 | 5 | public class Message { 6 | 7 | private String topic; 8 | 9 | private MqttMessage mMessage; 10 | 11 | public Message(String topic, MqttMessage message) { 12 | this.topic = topic; 13 | mMessage = message; 14 | } 15 | 16 | public String getTopic() { 17 | return topic; 18 | } 19 | 20 | public void setTopic(String topic) { 21 | this.topic = topic; 22 | } 23 | 24 | public MqttMessage getMessage() { 25 | return mMessage; 26 | } 27 | 28 | public void setMessage(MqttMessage message) { 29 | mMessage = message; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/java/io/emqx/mqtt/Subscription.java: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt; 2 | 3 | public class Subscription { 4 | 5 | private String topic; 6 | 7 | private int qos; 8 | 9 | public Subscription(String topic, int qos) { 10 | this.topic = topic; 11 | this.qos = qos; 12 | } 13 | 14 | public String getTopic() { 15 | return topic; 16 | } 17 | 18 | public void setTopic(String topic) { 19 | this.topic = topic; 20 | } 21 | 22 | public int getQos() { 23 | return qos; 24 | } 25 | 26 | public void setQos(int qos) { 27 | this.qos = qos; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/layout/fragment_message_list.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/layout/item_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 16dp 7 | 8dp 8 | 16dp 9 | -------------------------------------------------------------------------------- /mqtt-client-Android/app/src/test/java/io/emqx/mqtt/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package io.emqx.mqtt; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /mqtt-client-Android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:4.2.2' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /mqtt-client-Android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /mqtt-client-Android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 14 16:55:14 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip 7 | -------------------------------------------------------------------------------- /mqtt-client-Android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "Mqtt Example" -------------------------------------------------------------------------------- /mqtt-client-Angular.js/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .angular 3 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .angular 3 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .home-container { 2 | max-width: 1100px; 3 | margin: 0 auto; 4 | 5 | .conn-btn { 6 | color: #fff; 7 | background-color: #00b173; 8 | font-size: 14px; 9 | } 10 | 11 | .publish-btn { 12 | margin-bottom: 20px; 13 | float: right; 14 | } 15 | 16 | .mat-card { 17 | margin-bottom: 20px; 18 | } 19 | } -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Angular.js/Angular17/src/assets/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Angular.js/Angular17/src/favicon.ico -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MqttClientAngularJs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | // First, initialize the Angular testing environment. 11 | getTestBed().initTestEnvironment( 12 | BrowserDynamicTestingModule, 13 | platformBrowserDynamicTesting(), 14 | ); 15 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/Angular17/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .home-container { 2 | max-width: 1100px; 3 | margin: 0 auto; 4 | 5 | .conn-btn { 6 | color: #fff; 7 | background-color: #00b173; 8 | font-size: 14px; 9 | } 10 | 11 | .publish-btn { 12 | margin-bottom: 20px; 13 | float: right; 14 | } 15 | 16 | .mat-card { 17 | margin-bottom: 20px; 18 | } 19 | } -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Angular.js/src/assets/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Angular.js/src/favicon.ico -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MqttClientAngularJs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /mqtt-client-Angular.js/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/applications/mqtt_client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2021, RT-Thread Development Team 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Change Logs: 7 | * Date Author Notes 8 | * 2021-08-10 Hongwei Wang the first version 9 | */ 10 | #ifndef APPLICATIONS_MQTT_CLIENT_H_ 11 | #define APPLICATIONS_MQTT_CLIENT_H_ 12 | 13 | extern void mqtt_client_start(void); 14 | extern void mqtt_client_stop(void); 15 | 16 | #endif /* APPLICATIONS_MQTT_CLIENT_H_ */ 17 | -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/b7f3e53a4f6a789c698e5af8476d3e51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/b7f3e53a4f6a789c698e5af8476d3e51.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812042014559.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812042014559.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812042139878.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812042139878.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812042248923.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812042248923.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812043357450.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812043357450.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812044015699.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812044015699.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812113252985.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812113252985.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812160131240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812160131240.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812164508979.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812164508979.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812165116098.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812165116098.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210812173557767.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210812173557767.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813120217206.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813120217206.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813120347932.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813120347932.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813132147494.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813132147494.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813133146242.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813133146242.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813142338622.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813142338622.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813142515940.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813142515940.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813142846510.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813142846510.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210813142918921.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210813142918921.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210814171042277.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210814171042277.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210814172412786.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210814172412786.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/image-20210814181317020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/image-20210814181317020.png -------------------------------------------------------------------------------- /mqtt-client-C-RT-Thread/snapshots/wechat_20210812163029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-C-RT-Thread/snapshots/wechat_20210812163029.png -------------------------------------------------------------------------------- /mqtt-client-C-nng/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: WebKit 2 | UseTab: ForIndentation 3 | IndentWidth: 8 4 | ColumnLimit: 79 5 | AlignConsecutiveAssignments: true 6 | AlignConsecutiveDeclarations: true 7 | AlignTrailingComments: true 8 | AlignEscapedNewlines: Left 9 | PointerAlignment: Right 10 | DerivePointerAlignment: false 11 | ForEachMacros: ['NNI_LIST_FOREACH'] 12 | AlwaysBreakAfterReturnType: TopLevelDefinitions 13 | SpaceAfterCStyleCast: true 14 | AllowShortFunctionsOnASingleLine: Inline 15 | BreakBeforeBinaryOperators: None 16 | TabWidth: 8 17 | -------------------------------------------------------------------------------- /mqtt-client-C-nng/.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | build -------------------------------------------------------------------------------- /mqtt-client-C-paho/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.17) 2 | find_package(eclipse-paho-mqtt-c 1.3.9 REQUIRED) 3 | project(mqtt_c C) 4 | include_directories(/usr/local/include) 5 | link_directories(/usr/local/lib) 6 | set(CMAKE_C_STANDARD 99) 7 | add_executable(mqtt_c main.c) 8 | target_link_libraries(mqtt_c paho-mqtt3c) 9 | add_executable(emqx_file_transfer emqx_file_transfer.c) 10 | target_link_libraries(emqx_file_transfer paho-mqtt3c) 11 | add_executable(mqtt_tls_c main_tls.c) 12 | target_link_libraries(mqtt_tls_c paho-mqtt3cs) 13 | -------------------------------------------------------------------------------- /mqtt-client-Csharp-MqttNet/.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | packages/ 3 | -------------------------------------------------------------------------------- /mqtt-client-Csharp-MqttNet/pub-sub-tcp/pub-sub-tcp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | pub_sub_tcp 7 | enable 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /mqtt-client-Csharp-MqttNet/pub-sub-tls/pub-sub-tls.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | pub_sub_tls 7 | enable 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /mqtt-client-Csharp/MqttNetTLSClient/MqttNetClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /mqtt-client-Csharp/MqttNetTLSClient/Program.cs: -------------------------------------------------------------------------------- 1 | namespace MqttClient 2 | { 3 | class Program 4 | { 5 | 6 | static void Main(string[] args) 7 | { 8 | // 自签名证书单向认证 9 | // MqttClient.Client.TlsClientWithCA("E:/certs/cacert.pem").Wait(); 10 | 11 | // 双向认证 12 | MqttClient.Client.TlsClientWithCert(@"E:/certs/cacert.pem", @"E:/certs/client.pfx","123456").Wait(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /mqtt-client-Csharp/MqttNetTLSClient/obj/MqttNetClient.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /mqtt-client-Csharp/README.md: -------------------------------------------------------------------------------- 1 | # C# MQTT client examples 2 | In this example we provide example code for C# to subscribe to topics and send messages. 3 | For more documentation on the use of the paho.mqtt.m2mqtt client, see the [paho.mqtt.m2mqtt - documentation](https://www.eclipse.org/paho/index.php?page=clients/dotnet/index.php) 4 | 5 | 6 | ## Run 7 | Execute the following command in the publish or subscribe directory 8 | ```bash 9 | dotnet run 10 | ``` -------------------------------------------------------------------------------- /mqtt-client-Csharp/README_ZH.md: -------------------------------------------------------------------------------- 1 | # C# MQTT 客户端使用示例 2 | 在本示例中我们提供了 C# 订阅主题和发送信息的示例代码。 3 | 有关 paho.mqtt.m2mqtt 客户端更多使用文档,请参阅 [paho.mqtt.m2mqtt 官方文档](https://www.eclipse.org/paho/index.php?page=clients/dotnet/index.php)。 4 | 5 | 6 | ## 运行 7 | 在publish或者subscribe目录下执行以下命令 8 | ```bash 9 | dotnet run 10 | ``` 11 | -------------------------------------------------------------------------------- /mqtt-client-Csharp/publish/publish.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /mqtt-client-Csharp/subscribe/subscribe.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /mqtt-client-Django/django_mqtt/__init__.py: -------------------------------------------------------------------------------- 1 | from . import mqtt 2 | mqtt.client.loop_start() 3 | -------------------------------------------------------------------------------- /mqtt-client-Django/django_mqtt/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for django_mqtt project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_mqtt.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /mqtt-client-Django/django_mqtt/mqtt.py: -------------------------------------------------------------------------------- 1 | import paho.mqtt.client as mqtt 2 | from django.conf import settings 3 | 4 | 5 | def on_connect(mqtt_client, userdata, flags, rc): 6 | if rc == 0: 7 | print('Connected successfully') 8 | mqtt_client.subscribe('django/mqtt') 9 | else: 10 | print('Bad connection. Code:', rc) 11 | 12 | 13 | def on_message(mqtt_client, userdata, msg): 14 | print(f'Received message on topic: {msg.topic} with payload: {msg.payload}') 15 | 16 | 17 | client = mqtt.Client() 18 | client.on_connect = on_connect 19 | client.on_message = on_message 20 | client.username_pw_set(settings.MQTT_USER, settings.MQTT_PASSWORD) 21 | client.connect( 22 | host=settings.MQTT_SERVER, 23 | port=settings.MQTT_PORT, 24 | keepalive=settings.MQTT_KEEPALIVE 25 | ) 26 | -------------------------------------------------------------------------------- /mqtt-client-Django/django_mqtt/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | path('publish', views.publish_message, name='publish'), 7 | ] 8 | -------------------------------------------------------------------------------- /mqtt-client-Django/django_mqtt/views.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from django.http import JsonResponse 4 | 5 | from django_mqtt.mqtt import client as mqtt_client 6 | 7 | 8 | def publish_message(request): 9 | request_data = json.loads(request.body) 10 | rc, mid = mqtt_client.publish(request_data['topic'], request_data['msg']) 11 | return JsonResponse({'code': rc}) 12 | -------------------------------------------------------------------------------- /mqtt-client-Django/django_mqtt/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for django_mqtt project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_mqtt.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /mqtt-client-Django/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_mqtt.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | 3 | venv/ 4 | .idea/ 5 | __pycache__/ 6 | article/ 7 | 8 | *.db 9 | 10 | -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/_assets/esp32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-ESP32/esp32_DS18B20_temp_chart/_assets/esp32.png -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/_assets/fly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-ESP32/esp32_DS18B20_temp_chart/_assets/fly.png -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/_assets/webui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-ESP32/esp32_DS18B20_temp_chart/_assets/webui.png -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/web/.dockerignore: -------------------------------------------------------------------------------- 1 | # flyctl launch added from .idea/.gitignore 2 | # Default ignored files 3 | .idea/ 4 | 5 | # flyctl launch added from venv/.gitignore 6 | # created by virtualenv automatically 7 | venv/**/* 8 | 9 | fly.toml 10 | 11 | ./data/database.db 12 | 13 | ./__pycache__/ 14 | 15 | 16 | -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/web/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim-buster 2 | 3 | WORKDIR /app 4 | 5 | COPY . /app 6 | 7 | RUN pip install --no-cache-dir -r requirements.txt 8 | 9 | EXPOSE 8080 10 | 11 | CMD ["python", "app.py"] 12 | -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/web/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | -------------------------------------------------------------------------------- /mqtt-client-ESP32/esp32_DS18B20_temp_chart/web/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.3.2 2 | Flask-MQTT==1.1.1 3 | requests==2.31.0 -------------------------------------------------------------------------------- /mqtt-client-Electron/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /mqtt-client-Electron/README.md: -------------------------------------------------------------------------------- 1 | # MQTT-Client-Electron 2 | 3 | NPM: 4 | 5 | ```bash 6 | # Install dependencies 7 | npm install 8 | # Run the app 9 | npm start 10 | ``` 11 | 12 | Yarn: 13 | 14 | ```bash 15 | # Install dependencies 16 | yarn install 17 | # Run the app 18 | yarn start 19 | ``` 20 | -------------------------------------------------------------------------------- /mqtt-client-Electron/main.css: -------------------------------------------------------------------------------- 1 | .card.connection button { 2 | border-radius: 0px; 3 | } 4 | .mqtt-sub-pub.columns { 5 | padding: 24px; 6 | } 7 | .mqtt-sub-pub .card { 8 | height: 432px; 9 | overflow: scroll; 10 | } 11 | 12 | .select { 13 | display: block; 14 | } 15 | .select select { 16 | width: 100%; 17 | } 18 | 19 | #path-ipt { 20 | display: none; 21 | } 22 | 23 | #file-area { 24 | display: none; 25 | } 26 | -------------------------------------------------------------------------------- /mqtt-client-Electron/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-quick-start", 3 | "version": "1.0.0", 4 | "description": "A minimal Electron application", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron ." 8 | }, 9 | "repository": "https://github.com/electron/electron-quick-start", 10 | "keywords": [ 11 | "Electron", 12 | "quick", 13 | "start", 14 | "tutorial", 15 | "demo" 16 | ], 17 | "author": "GitHub", 18 | "license": "CC0-1.0", 19 | "dependencies": { 20 | "bulma": "^0.9.0", 21 | "mqtt": "^4.3.7" 22 | }, 23 | "devDependencies": { 24 | "electron": "19.0.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mqtt-client-Electron/preload.js: -------------------------------------------------------------------------------- 1 | // All of the Node.js APIs are available in the preload process. 2 | // It has the same sandbox as a Chrome extension. 3 | const mqtt = require('mqtt') 4 | window.mqtt = mqtt 5 | -------------------------------------------------------------------------------- /mqtt-client-Elixir/.tool-versions: -------------------------------------------------------------------------------- 1 | elixir 1.14.3-otp-25 2 | erlang 25.2.3 3 | -------------------------------------------------------------------------------- /mqtt-client-Elixir/README.md: -------------------------------------------------------------------------------- 1 | # Elixir MQTT client examples 2 | In this example we provide example code for [Elixir](https://elixir-lang.org/) to subscribe to topics and send messages. 3 | We use [`emqtt`](https://github.com/emqx/emqtt) client. For more documentation, see [`emqtt` documentation](https://github.com/emqx/emqtt/blob/master/README.md). 4 | 5 | We demonstrate 6 | * basic publish/subscribe operations with different QOS; 7 | * options to connect to the broker securely via TLS. 8 | 9 | ## Run 10 | Execute the following commands 11 | 12 | ```bash 13 | elixir mqtt.exs 14 | elixir mqtt_tls.exs 15 | ``` 16 | 17 | Elixir may ask permission to install Hex client before running the scripts. 18 | -------------------------------------------------------------------------------- /mqtt-client-Elixir/README_ZH.md: -------------------------------------------------------------------------------- 1 | # Elixir MQTT 客户端示例 2 | 在此示例中,我们提供了 [Elixir](https://elixir-lang.org/) 订阅主题和发送消息的示例代码。 3 | 我们使用 [`emqtt`](https://github.com/emqx/emqtt) 客户端。 有关更多文档,请参阅 [`emqtt` 文档](https://github.com/emqx/emqtt/blob/master/README.md)。 4 | 5 | 我们演示 6 | * 具有不同 QOS 的基本发布/订阅操作; 7 | * 通过 TLS 安全连接到代理的选项。 8 | 9 | ## 运行 10 | 执行以下命令 11 | 12 | ```bash 13 | elixir mqtt.exs 14 | elixir mqtt_tls.exs 15 | ``` 16 | 17 | 在运行脚本之前,Elixir 可能会请求安装 Hex 客户端的权限。 18 | -------------------------------------------------------------------------------- /mqtt-client-Erlang/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | rebar.lock 3 | -------------------------------------------------------------------------------- /mqtt-client-Erlang/certs/README: -------------------------------------------------------------------------------- 1 | These files are copied from https://github.com/emqx/emqx 2 | Place your SSL/TLS Certificates here. 3 | -------------------------------------------------------------------------------- /mqtt-client-Erlang/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, [ 3 | {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.9.5"}}} 4 | ]}. 5 | 6 | {shell, [ 7 | % {config, "config/sys.config"}, 8 | {apps, [mqttex]} 9 | ]}. 10 | -------------------------------------------------------------------------------- /mqtt-client-Erlang/src/mqttex.app.src: -------------------------------------------------------------------------------- 1 | {application, mqttex, 2 | [{description, "MQTT Client Examples"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, {mqttex_app, []}}, 6 | {applications, [kernel, stdlib]}, 7 | {env,[]}, 8 | {modules, []}, 9 | {licenses, ["Apache 2.0"]}, 10 | {links, []} 11 | ]}. 12 | -------------------------------------------------------------------------------- /mqtt-client-Flask/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.so 3 | 4 | venv/ 5 | .idea/ 6 | __pycache__/ 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-Flask/README_ZH.md: -------------------------------------------------------------------------------- 1 | # Flask MQTT 客户端示例 2 | 3 | 本仓库提供了一个 Flask MQTT 客户端示例,具有自动重连和消息发布功能。它适合初学者学习如何在 Flask 应用程序中集成 MQTT,并处理消息订阅和发布。 4 | 5 | ## 特点 6 | 7 | - 连接到 MQTT 代理。 8 | - 订阅 MQTT 主题。 9 | - 向 MQTT 主题发布消息。 10 | - 在意外断开连接时自动重连。 11 | 12 | ## 要求 13 | 14 | - Python 3 15 | - Flask 16 | - Flask-MQTT 17 | 18 | ## 安装 19 | 20 | 克隆仓库: 21 | 22 | ```bash 23 | git clone https://github.com/emqx/MQTT-Client-Examples.git 24 | cd mqtt-client-Flask 25 | ``` 26 | 27 | 安装依赖: 28 | 29 | ```bash 30 | pip install -r requirements.txt 31 | ``` 32 | 33 | ## 运行应用程序 34 | 35 | 启动应用程序: 36 | 37 | ```bash 38 | python flask_mqtt_app.py 39 | ``` 40 | 41 | ## 使用方法 42 | 43 | - MQTT 客户端订阅指定的主题,并记录收到的任何消息。 44 | - 打开首页,会向主题发送一条消息。 45 | 46 | ## 贡献 47 | 48 | 欢迎对该项目做出贡献。请开一个问题或提交一个带有您建议的拉取请求。 -------------------------------------------------------------------------------- /mqtt-client-Flask/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.3.2 2 | Flask-MQTT==1.1.1 -------------------------------------------------------------------------------- /mqtt-client-Flutter/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .dart_tool/ 3 | /build/ 4 | .idea/ 5 | .flutter-plugins 6 | .packages 7 | .pub-cache/ 8 | .pub/ -------------------------------------------------------------------------------- /mqtt-client-Flutter/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-Flutter/README.md: -------------------------------------------------------------------------------- 1 | # Flutter MQTT example 2 | A simple demo to show how to use mqtt with flutter. 3 | 4 | ## Prerequisites 5 | - Android Studio 6 | - [Flutter](https://flutter.dev/docs/get-started/install) 7 | 8 | ## Installation 9 | ```bash 10 | flutter pub get 11 | ``` 12 | 13 | ## Run 14 | Import project to Android Studio and run 15 | 16 | 17 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/kotlin/io/emqx/flutter_mqtt/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.emqx.flutter_mqtt 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip 7 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/assets/certs/client.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | xxxxx 3 | -----END CERTIFICATE----- 4 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/assets/certs/client.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | xxxxx 3 | -----END RSA PRIVATE KEY----- 4 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/assets/certs/server-ca.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | xxxxx 3 | -----END CERTIFICATE----- 4 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /mqtt-client-Flutter/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /mqtt-client-Flutter/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/web/favicon.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/web/icons/Icon-192.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Flutter/web/icons/Icon-512.png -------------------------------------------------------------------------------- /mqtt-client-Flutter/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_mqtt", 3 | "short_name": "flutter_mqtt", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter application.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /mqtt-client-Go/README.md: -------------------------------------------------------------------------------- 1 | # Golang MQTT Client Example 2 | 3 | In this example we provide example code for TCP, Websocket, TLS, and Websockets protocols to connect to the MQTT Broker. 4 | For more documentation on the use of the go paho-mqtt client, see the [Go Client - documentation](https://godoc.org/github.com/eclipse/paho.mqtt.golang) 5 | 6 | ## Prerequisites 7 | 8 | * It supports go 1.13+ 9 | 10 | ## Install 11 | 12 | ```shell script 13 | go get github.com/eclipse/paho.mqtt.golang 14 | go get github.com/gorilla/websocket 15 | go get golang.org/x/net/proxy 16 | ``` -------------------------------------------------------------------------------- /mqtt-client-Go/README_ZH.md: -------------------------------------------------------------------------------- 1 | # Go MQTT 客户端使用示例 2 | 3 | 在本示例中我们提供了 TCP、Websocket、TLS、Websockets 协议连接到 MQTT Broker 示例代码。 有关 Go paho-mqtt 4 | 客户端更多使用文档,请参阅 [paho-mqtt 官方文档](https://godoc.org/github.com/eclipse/paho.mqtt.golang)。 5 | 6 | ## 前提 7 | 8 | * 支持 go 1.13+ 9 | 10 | ## 安装 11 | 12 | ```shell script 13 | go get github.com/eclipse/paho.mqtt.golang 14 | go get github.com/gorilla/websocket 15 | go get golang.org/x/net/proxy 16 | ``` 17 | -------------------------------------------------------------------------------- /mqtt-client-Go/file-transfer/go.mod: -------------------------------------------------------------------------------- 1 | module file-transfer 2 | 3 | go 1.20 4 | 5 | require github.com/eclipse/paho.mqtt.golang v1.4.2 6 | 7 | require ( 8 | github.com/gorilla/websocket v1.5.0 // indirect 9 | golang.org/x/net v0.11.0 // indirect 10 | golang.org/x/sync v0.3.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /mqtt-client-Go/one_way-tls/README.md: -------------------------------------------------------------------------------- 1 | # Golang One-Way TLS Connection Example 2 | 3 | ## Install 4 | 5 | ```shell script 6 | go get github.com/eclipse/paho.mqtt.golang 7 | go get github.com/gorilla/websocket 8 | go get golang.org/x/net/proxy 9 | ``` 10 | 11 | ## Run 12 | 13 | ### Certificate Generation 14 | 15 | ```bash 16 | # generate service certificate 17 | ./server.sh 18 | ``` 19 | 20 | ### Run Pub and Sub 21 | 22 | ```bash 23 | # Ca-signed server cert 24 | go run main.go -host broker.emqx.io -port 8883 25 | 26 | # self-signed server cert 27 | go run main.go -host 127.0.0.1 -port 8883 --cafile ./server/server-ca.crt 28 | ``` -------------------------------------------------------------------------------- /mqtt-client-Go/one_way-tls/go.mod: -------------------------------------------------------------------------------- 1 | module one_way-tls 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/eclipse/paho.mqtt.golang v1.2.0 7 | golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/go.mod: -------------------------------------------------------------------------------- 1 | module pubsub 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/eclipse/paho.mqtt.golang v1.2.0 7 | github.com/google/uuid v1.3.0 8 | golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect 9 | ) 10 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/protocols/config.go: -------------------------------------------------------------------------------- 1 | package protocols 2 | 3 | type Config struct { 4 | Host string 5 | Port int 6 | Action string 7 | Topic string 8 | Username string 9 | Password string 10 | Qos int 11 | Tls bool 12 | CaCert string 13 | } 14 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/protocols/global_var.go: -------------------------------------------------------------------------------- 1 | package protocols 2 | 3 | var ExitFlag bool = false 4 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/protocols/use_ssl.go: -------------------------------------------------------------------------------- 1 | package protocols 2 | 3 | import "log" 4 | 5 | func MQTTSConnection(config Config) { 6 | client := connectByMQTTS(config) 7 | action := config.Action 8 | switch action { 9 | case "pub": 10 | Pub(client, config.Topic) 11 | case "sub": 12 | Sub(client, config.Topic) 13 | case "pubsub": 14 | PubSub(client, config.Topic) 15 | default: 16 | log.Fatalf("Unsupported action: %s", action) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/protocols/use_tcp.go: -------------------------------------------------------------------------------- 1 | package protocols 2 | 3 | import "log" 4 | 5 | func MQTTConnection(config Config) { 6 | client := connectByMQTT(config) 7 | action := config.Action 8 | switch action { 9 | case "pub": 10 | Pub(client, config.Topic) 11 | case "sub": 12 | Sub(client, config.Topic) 13 | case "pubsub": 14 | PubSub(client, config.Topic) 15 | default: 16 | log.Fatalf("Unsupported action: %s", action) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/protocols/use_ws.go: -------------------------------------------------------------------------------- 1 | package protocols 2 | 3 | import "log" 4 | 5 | func WSConnection(config Config) { 6 | client := connectByWS(config) 7 | action := config.Action 8 | switch action { 9 | case "pub": 10 | Pub(client, config.Topic) 11 | case "sub": 12 | Sub(client, config.Topic) 13 | case "pubsub": 14 | PubSub(client, config.Topic) 15 | default: 16 | log.Fatalf("Unsupported action: %s", action) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mqtt-client-Go/pubsub/protocols/use_wss.go: -------------------------------------------------------------------------------- 1 | package protocols 2 | 3 | import "log" 4 | 5 | func WSSConnection(config Config) { 6 | client := connectByWSS(config) 7 | action := config.Action 8 | switch action { 9 | case "pub": 10 | Pub(client, config.Topic) 11 | case "sub": 12 | Sub(client, config.Topic) 13 | case "pubsub": 14 | PubSub(client, config.Topic) 15 | default: 16 | log.Fatalf("Unsupported action: %s", action) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mqtt-client-Go/two_way-tls/README.md: -------------------------------------------------------------------------------- 1 | # Golang Two-Way TLS Connection Example 2 | 3 | ## Install 4 | 5 | ```shell script 6 | go get github.com/eclipse/paho.mqtt.golang 7 | go get github.com/gorilla/websocket 8 | go get golang.org/x/net/proxy 9 | ``` 10 | 11 | ## Run 12 | 13 | ### Certificate Generation 14 | 15 | ```bash 16 | # generate service certificate 17 | ./server.sh 18 | # generate client certificate 19 | ./client.sh 20 | ``` 21 | 22 | ### Run Pub and Sub 23 | 24 | ```bash 25 | go run main.go -host 127.0.0.1 -port 8883 --cafile ./server/server-ca.crt --cert ./client/client.crt --key ./client/client.key 26 | ``` -------------------------------------------------------------------------------- /mqtt-client-Go/two_way-tls/client.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | rm -rf ./client && mkdir -p ./client && cd ./client || exit 6 | 7 | openssl req \ 8 | -new \ 9 | -newkey rsa:2048 \ 10 | -days 365 \ 11 | -nodes \ 12 | -x509 \ 13 | -subj "/C=CN/O=EMQ Technologies Co., Ltd/CN=EMQ Client CA" \ 14 | -keyout client-ca.key \ 15 | -out client-ca.crt 16 | 17 | openssl genrsa -out client.key 2048 18 | 19 | openssl req -new -key client.key -out client.csr -subj "/CN=Client-$(date +'%Y%m%d%H%M%S')" 20 | 21 | openssl x509 -req -days 365 -sha256 -in client.csr -CA client-ca.crt -CAkey client-ca.key -CAcreateserial -out client.crt 22 | -------------------------------------------------------------------------------- /mqtt-client-Go/two_way-tls/go.mod: -------------------------------------------------------------------------------- 1 | module two_way-tls 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/eclipse/paho.mqtt.golang v1.2.0 7 | golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /mqtt-client-Java/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /target 3 | *.iml -------------------------------------------------------------------------------- /mqtt-client-Java/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Java/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-JavaScript/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | -------------------------------------------------------------------------------- /mqtt-client-Micropython/v1.22_and_earlier/wifi.py: -------------------------------------------------------------------------------- 1 | import network 2 | import time 3 | 4 | def connect(): 5 | ssid = 'NAME OF YOUR WIFI NETWORK' 6 | password = 'PASSWORD OF YOUR WIFI NETWORK' 7 | wlan = network.WLAN(network.STA_IF) 8 | wlan.active(True) 9 | wlan.connect(ssid, password) 10 | while wlan.isconnected() == False: 11 | print('Waiting for connection...') 12 | time.sleep(1) 13 | print('Connected on {ip}'.format(ip = wlan.ifconfig()[0])) 14 | -------------------------------------------------------------------------------- /mqtt-client-Micropython/v1.23_and_above/certs/broker.emqx.io-ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Micropython/v1.23_and_above/certs/broker.emqx.io-ca.der -------------------------------------------------------------------------------- /mqtt-client-Micropython/v1.23_and_above/certs/emqx-dedicated-ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Micropython/v1.23_and_above/certs/emqx-dedicated-ca.der -------------------------------------------------------------------------------- /mqtt-client-Micropython/v1.23_and_above/certs/emqxsl-ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Micropython/v1.23_and_above/certs/emqxsl-ca.der -------------------------------------------------------------------------------- /mqtt-client-Micropython/v1.23_and_above/wifi.py: -------------------------------------------------------------------------------- 1 | import network 2 | import time 3 | 4 | def connect(): 5 | ssid = 'NAME OF YOUR WIFI NETWORK' 6 | password = 'PASSWORD OF YOUR WIFI NETWORK' 7 | wlan = network.WLAN(network.STA_IF) 8 | wlan.active(True) 9 | wlan.connect(ssid, password) 10 | while wlan.isconnected() == False: 11 | print('Waiting for connection...') 12 | time.sleep(1) 13 | print('Connected on {ip}'.format(ip = wlan.ifconfig()[0])) -------------------------------------------------------------------------------- /mqtt-client-Node.js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | yarn.lock 3 | -------------------------------------------------------------------------------- /mqtt-client-Node.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client-node.js", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "Apache", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "dependencies": { 10 | "mqtt": "^4.3.7" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /mqtt-client-Node.js/use_mqtt.js: -------------------------------------------------------------------------------- 1 | const connectOptions = { 2 | protocol: 'mqtt', 3 | port: 1883, 4 | host: 'broker.emqx.io', 5 | } 6 | 7 | module.exports = { 8 | connectOptions, 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-Node.js/use_mqtts.js: -------------------------------------------------------------------------------- 1 | const connectOptions = { 2 | protocol: 'mqtts', 3 | port: 8883, 4 | host: 'broker.emqx.io', 5 | } 6 | 7 | module.exports = { 8 | connectOptions, 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-Node.js/use_ws.js: -------------------------------------------------------------------------------- 1 | const connectOptions = { 2 | protocol: 'ws', 3 | port: 8083, 4 | host: 'broker.emqx.io', 5 | } 6 | 7 | module.exports = { 8 | connectOptions, 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-Node.js/use_wss.js: -------------------------------------------------------------------------------- 1 | const connectOptions = { 2 | protocol: 'wss', 3 | port: 8084, 4 | host: 'broker.emqx.io', 5 | } 6 | 7 | module.exports = { 8 | connectOptions, 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-PHP/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | vendor/ -------------------------------------------------------------------------------- /mqtt-client-PHP/README_ZH.md: -------------------------------------------------------------------------------- 1 | # PHP MQTT 客户端使用示例 2 | 3 | 在本示例中我们提供了 TCP、TLS 协议连接到 MQTT Broker 示例代码。 4 | 5 | 示例选择了 composer 上下载量最高的 `php-mqtt/client` 这个客户端库,也有[一些](https://packagist.org/search/?query=mqtt)优秀的基于 [Swoole](https://www.swoole.com/) 的客户端库欢迎大家去使用,提交 sample 与名单到此仓库中。 6 | 7 | 有关 php-mqtt/client 更多使用文档请参阅 [Packagist php-mqtt/client](https://packagist.org/packages/php-mqtt/client)。 8 | 9 | ## 前提 10 | 11 | PHP 7.4 及以上版本 12 | 13 | ## 安装 14 | 15 | ```bash 16 | composer require php-mqtt/client 17 | ``` 18 | 19 | ## 运行 20 | 21 | ```bash 22 | python pubsub_tcp.php 23 | ``` 24 | 25 | ## 参阅 26 | 27 | [如何在 PHP 中使用 MQTT](https://www.emqx.com/zh/blog/how-to-use-mqtt-in-php) 28 | -------------------------------------------------------------------------------- /mqtt-client-PHP/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php-mqtt/client": "v1.6.0", 4 | "bluerhinos/phpmqtt": "@dev", 5 | "simps/mqtt": "^1.4", 6 | "ext-swoole": "^4.8", 7 | "swoole/ide-helper": "^4.8" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-PHP/phpMQTT_pubsub.php: -------------------------------------------------------------------------------- 1 | connect(false, null, $username, $password); 16 | 17 | if ($conn_result) { 18 | $topics['emqx/test'] = array("qos"=>0, "function"=>"procmsg"); 19 | $c -> subscribe($topics); 20 | } 21 | 22 | function procmsg($topic, $msg) { 23 | echo "recv $topic from $msg"; 24 | } 25 | 26 | while ($c->proc()) { 27 | } -------------------------------------------------------------------------------- /mqtt-client-Python3/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | 3 | message_log.db 4 | 5 | client.crt 6 | client.key 7 | server-ca.crt -------------------------------------------------------------------------------- /mqtt-client-Python3/README_ZH.md: -------------------------------------------------------------------------------- 1 | # Python MQTT 客户端使用示例 2 | 在本示例中我们提供了 TCP、Websocket、TLS、Websockets 协议连接到 MQTT Broker 示例代码。 3 | 有关 Python paho-mqtt 客户端更多使用文档,请参阅 [paho-mqtt 官方文档](https://www.eclipse.org/paho/index.php?page=clients/python/docs/index.php)。 4 | 5 | 6 | ## 前提 7 | * 仅支持 Python 3.4+ 版本 8 | 9 | 10 | ## 安装 11 | ```bash 12 | pip install paho-mqtt 13 | ``` 14 | 15 | 16 | ## 运行 17 | ```bash 18 | python3 pub_sub_tcp.py 19 | ``` 20 | 21 | ## 参阅 22 | [如何在 Python 中使用 MQTT](https://www.emqx.cn/blog/how-to-use-mqtt-in-python) 23 | 24 | -------------------------------------------------------------------------------- /mqtt-client-Qt/client.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = qmqtt_example 3 | QT = core network qmqtt 4 | 5 | SOURCES += \ 6 | example.cpp 7 | 8 | target.path = $$[QT_INSTALL_EXAMPLES]/qmqtt/client 9 | INSTALLS += target 10 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .expo/ 3 | dist/ 4 | npm-debug.* 5 | *.jks 6 | *.p8 7 | *.p12 8 | *.key 9 | *.mobileprovision 10 | *.orig.* 11 | web-build/ 12 | 13 | # macOS 14 | .DS_Store 15 | 16 | # @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb 17 | # The following patterns were generated by expo-cli 18 | 19 | expo-env.d.ts 20 | # @end expo-cli -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/app/(tabs)/_layout.tsx: -------------------------------------------------------------------------------- 1 | import { Tabs } from "expo-router"; 2 | import React from "react"; 3 | 4 | export default function TabLayout() { 5 | return ( 6 | 7 | 14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/assets/fonts/SpaceMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native-Expo/assets/fonts/SpaceMono-Regular.ttf -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/assets/images/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native-Expo/assets/images/adaptive-icon.png -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native-Expo/assets/images/favicon.png -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/assets/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native-Expo/assets/images/icon.png -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/assets/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native-Expo/assets/images/splash.png -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true); 3 | return { 4 | presets: ["babel-preset-expo"], 5 | plugins: ["react-native-reanimated/plugin"], 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/components/ThemedView.tsx: -------------------------------------------------------------------------------- 1 | import { View, type ViewProps } from 'react-native'; 2 | 3 | import { useThemeColor } from '@/hooks/useThemeColor'; 4 | 5 | export type ThemedViewProps = ViewProps & { 6 | lightColor?: string; 7 | darkColor?: string; 8 | }; 9 | 10 | export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) { 11 | const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background'); 12 | 13 | return ; 14 | } 15 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/hooks/useColorScheme.ts: -------------------------------------------------------------------------------- 1 | export { useColorScheme } from 'react-native'; 2 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/hooks/useColorScheme.web.ts: -------------------------------------------------------------------------------- 1 | // NOTE: The default React Native styling doesn't support server rendering. 2 | // Server rendered styles should not change between the first render of the HTML 3 | // and the first render on the client. Typically, web developers will use CSS media queries 4 | // to render different styles on the client and server, these aren't directly supported in React Native 5 | // but can be achieved using a styling library like Nativewind. 6 | export function useColorScheme() { 7 | return 'light'; 8 | } 9 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/hooks/useThemeColor.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Learn more about light and dark modes: 3 | * https://docs.expo.dev/guides/color-schemes/ 4 | */ 5 | 6 | import { useColorScheme } from 'react-native'; 7 | 8 | import { Colors } from '@/constants/Colors'; 9 | 10 | export function useThemeColor( 11 | props: { light?: string; dark?: string }, 12 | colorName: keyof typeof Colors.light & keyof typeof Colors.dark 13 | ) { 14 | const theme = useColorScheme() ?? 'light'; 15 | const colorFromProps = props[theme]; 16 | 17 | if (colorFromProps) { 18 | return colorFromProps; 19 | } else { 20 | return Colors[theme][colorName]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /mqtt-client-React-Native-Expo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo/tsconfig.base", 3 | "compilerOptions": { 4 | "strict": true, 5 | "paths": { 6 | "@/*": [ 7 | "./*" 8 | ] 9 | } 10 | }, 11 | "include": [ 12 | "**/*.ts", 13 | "**/*.tsx", 14 | ".expo/types/**/*.ts", 15 | "expo-env.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/README.md: -------------------------------------------------------------------------------- 1 | # mqtt-client-React-Native 2 | 3 | A simple demo to show how to use mqtt with React Native. 4 | 5 | 6 | 7 | ## Prerequisites 8 | 9 | * Xcode and iOS Simulator 10 | 11 | 12 | 13 | ## Installation 14 | 15 | Execute the following command in the `RNMQTTDemo` directory environment 16 | 17 | ```shell 18 | npm install 19 | ``` 20 | 21 | Execute the following command in the `RNMQTTDemo/ios` directory environment 22 | 23 | ```shell 24 | pod install 25 | ``` 26 | 27 | 28 | 29 | ## Run 30 | 31 | In the `RNMQTTDemo` directory environment, create two new terminal windows and execute the following commands respectively 32 | 33 | ```shell 34 | npx react-native start 35 | ``` 36 | 37 | ```shell 38 | npx react-native run-ios 39 | ``` 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: false, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.4 2 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby '2.7.4' 5 | 6 | gem 'cocoapods', '~> 1.11', '>= 1.11.2' 7 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/debug.keystore -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/jni/MainApplicationModuleProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace facebook { 9 | namespace react { 10 | 11 | std::shared_ptr MainApplicationModuleProvider( 12 | const std::string moduleName, 13 | const JavaTurboModule::InitParams ¶ms); 14 | 15 | } // namespace react 16 | } // namespace facebook 17 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/jni/OnLoad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "MainApplicationTurboModuleManagerDelegate.h" 3 | #include "MainComponentsRegistry.h" 4 | 5 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { 6 | return facebook::jni::initialize(vm, [] { 7 | facebook::react::MainApplicationTurboModuleManagerDelegate:: 8 | registerNatives(); 9 | facebook::react::MainComponentsRegistry::registerNatives(); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RNMQTTDemo 3 | 4 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React-Native/RNMQTTDemo/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RNMQTTDemo' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../node_modules/react-native-gradle-plugin') 5 | 6 | if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { 7 | include(":ReactAndroid") 8 | project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid') 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNMQTTDemo", 3 | "displayName": "RNMQTTDemo" 4 | } -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/ios/RNMQTTDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/ios/RNMQTTDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/ios/RNMQTTDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/ios/RNMQTTDemo/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mqtt-client-React-Native/RNMQTTDemo/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: true, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /mqtt-client-React/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /mqtt-client-React/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-React/public/favicon.ico -------------------------------------------------------------------------------- /mqtt-client-React/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /mqtt-client-React/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /mqtt-client-React/src/App.css: -------------------------------------------------------------------------------- 1 | @import '~antd/dist/antd.css'; 2 | 3 | .App { 4 | background-color: #282c34; 5 | min-height: 100vh; 6 | padding: 40px; 7 | display: flex; 8 | flex-direction: column; 9 | align-items: center; 10 | justify-content: center; 11 | font-size: calc(10px + 2vmin); 12 | color: white; 13 | } 14 | 15 | .App .ant-card { 16 | width: 100%; 17 | max-width: 850px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | .ant-form-inline .ant-form-item { 22 | margin-bottom: 20px; 23 | } 24 | -------------------------------------------------------------------------------- /mqtt-client-React/src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import HookMqtt from './components/Hook/' 3 | // Hook or Class 4 | // import ClassMqtt from './components/Class/' 5 | import './App.css' 6 | 7 | function App() { 8 | return ( 9 |
10 | 11 | {/* Hook or Class */} 12 | {/* */} 13 |
14 | ) 15 | } 16 | 17 | export default App 18 | -------------------------------------------------------------------------------- /mqtt-client-React/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /mqtt-client-React/src/components/Class/Receiver.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Card, List } from "antd"; 3 | 4 | class Receiver extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | this.state = {}; 8 | } 9 | 10 | render() { 11 | const renderListItem = (item) => ( 12 | 13 | 14 | 15 | ); 16 | 17 | return ( 18 | 19 | 25 | 26 | ); 27 | } 28 | } 29 | 30 | export default Receiver; 31 | -------------------------------------------------------------------------------- /mqtt-client-React/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /mqtt-client-React/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom/client' 3 | import './index.css' 4 | import App from './App' 5 | import * as serviceWorker from './serviceWorker' 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')) 8 | root.render() 9 | 10 | // If you want your app to work offline and load faster, you can change 11 | // unregister() to register() below. Note this comes with some pitfalls. 12 | // Learn more about service workers: https://bit.ly/CRA-PWA 13 | serviceWorker.unregister() 14 | -------------------------------------------------------------------------------- /mqtt-client-React/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /mqtt-client-SpringBoot/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-SpringBoot/.gitkeep -------------------------------------------------------------------------------- /mqtt-client-Vue.js/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ["plugin:vue/essential", "eslint:recommended", "@vue/prettier"], 7 | parserOptions: { 8 | parser: "babel-eslint" 9 | }, 10 | rules: { 11 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", 12 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": false, 6 | "trailingComma": "all", 7 | "printWidth": 120, 8 | "bracketSpacing": true 9 | } 10 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/README.md: -------------------------------------------------------------------------------- 1 | # VUE-MQTT-DEMO 2 | 3 | **[Online demo](https://codesandbox.io/s/funny-water-h2hmj?file=/src/main.js)** 4 | > it is an https webpage, so it uses a wss connection 5 | 6 | ## Project setup 7 | ``` 8 | yarn install 9 | ``` 10 | 11 | ### Compiles and hot-reloads for development 12 | ``` 13 | yarn run serve 14 | ``` 15 | 16 | ### Compiles and minifies for production 17 | ``` 18 | yarn run build 19 | ``` 20 | 21 | ### Run your tests 22 | ``` 23 | yarn run test 24 | ``` 25 | 26 | ### Lints and fixes files 27 | ``` 28 | yarn run lint 29 | ``` 30 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"] 3 | }; 4 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Vue.js/public/favicon.ico -------------------------------------------------------------------------------- /mqtt-client-Vue.js/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 18 | -------------------------------------------------------------------------------- /mqtt-client-Vue.js/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import ElementUI from 'element-ui' 4 | import 'element-ui/lib/theme-chalk/index.css' 5 | 6 | Vue.config.productionTip = false 7 | Vue.use(ElementUI) 8 | 9 | new Vue({ 10 | render: h => h(App), 11 | }).$mount('#app') 12 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | .DS_Store 12 | dist 13 | dist-ssr 14 | coverage 15 | *.local 16 | 17 | /cypress/videos/ 18 | /cypress/screenshots/ 19 | 20 | # Editor directories and files 21 | .vscode/* 22 | !.vscode/extensions.json 23 | .idea 24 | *.suo 25 | *.ntvs* 26 | *.njsproj 27 | *.sln 28 | *.sw? 29 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | EMQX Vue3 MQTT Demo 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emqx-vue3-mqtt-demo", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "run-p type-check build-only", 8 | "preview": "vite preview", 9 | "build-only": "vite build", 10 | "type-check": "vue-tsc --noEmit" 11 | }, 12 | "dependencies": { 13 | "element-plus": "^2.3.3", 14 | "mqtt": "^4.3.7", 15 | "vue": "^3.2.47" 16 | }, 17 | "devDependencies": { 18 | "@types/node": "^18.14.2", 19 | "@vitejs/plugin-vue": "^4.0.0", 20 | "@vue/tsconfig": "^0.1.3", 21 | "npm-run-all": "^4.1.5", 22 | "typescript": "~4.8.4", 23 | "vite": "^4.1.4", 24 | "vue-tsc": "^1.2.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-Vue3.js/public/favicon.ico -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/shims-mqtt.d.ts: -------------------------------------------------------------------------------- 1 | declare module "mqtt/dist/mqtt.min" { 2 | import MQTT from "mqtt"; 3 | export = MQTT; 4 | } 5 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import ElementPlus from "element-plus"; 3 | import "element-plus/dist/index.css"; 4 | 5 | import App from "./App.vue"; 6 | 7 | createApp(App).use(ElementPlus).mount("#app"); 8 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.web.json", 3 | "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "shims-mqtt.d.ts"], 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "paths": { 7 | "@/*": ["./src/*"] 8 | }, 9 | "skipLibCheck": true, 10 | }, 11 | "references": [ 12 | { 13 | "path": "./tsconfig.node.json" 14 | } 15 | ], 16 | } 17 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@vue/tsconfig/tsconfig.node.json", 3 | "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"], 4 | "compilerOptions": { 5 | "composite": true, 6 | "types": ["node"], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /mqtt-client-Vue3.js/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath, URL } from "node:url"; 2 | 3 | import { defineConfig } from "vite"; 4 | import vue from "@vitejs/plugin-vue"; 5 | 6 | // https://vitejs.dev/config/ 7 | export default defineConfig({ 8 | plugins: [vue()], 9 | resolve: { 10 | alias: { 11 | "@": fileURLToPath(new URL("./src", import.meta.url)), 12 | }, 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /mqtt-client-WebSocket/README.md: -------------------------------------------------------------------------------- 1 | # MQTT-Client-WebSocket 2 | 3 | You can directly open the `ws-mqtt.html` file in your browser and view the demo results in the console. 4 | 5 | Or use key codes in the project for testing. 6 | -------------------------------------------------------------------------------- /mqtt-client-swift/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-swift/Cartfile: -------------------------------------------------------------------------------- 1 | github "robbiehanson/CocoaAsyncSocket" "7.6.5" 2 | github "daltoniam/Starscream" "3.1.1" 3 | -------------------------------------------------------------------------------- /mqtt-client-swift/CocoaMQTT.xcodeproj/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /mqtt-client-swift/CocoaMQTT.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-swift/CocoaMQTT.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-swift/CocoaMQTT.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-swift/CocoaMQTTTests/client-keycert.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/CocoaMQTTTests/client-keycert.p12 -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Double Down Green.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Double Down.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Double Down Green.imageset/Double Down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Double Down Green.imageset/Double Down.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Double Down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Double Down-100.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Double Down.imageset/Double Down-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Double Down.imageset/Double Down-100.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Down-green.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Down-green.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Down-green.imageset/Down-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Down-green.imageset/Down-green.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Down.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Down.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Down.imageset/Down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Down.imageset/Down.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Horse.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Horse100.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Horse.imageset/Horse100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Horse.imageset/Horse100.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Pig.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Pig100.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Pig.imageset/Pig100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Pig.imageset/Pig100.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Sheep.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Sheep100.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/Sheep.imageset/Sheep100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/Sheep.imageset/Sheep100.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/animals.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "animals.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/animals.imageset/animals.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/animals.imageset/animals.jpg -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/left_message_back.imageset/chatfrom_bg_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/left_message_back.imageset/chatfrom_bg_normal.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/other.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "other.jpg", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/other.imageset/other.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/other.imageset/other.jpg -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/right_message_back.imageset/chatto_bg_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/right_message_back.imageset/chatto_bg_normal.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Horse.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Horse@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Horse@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Horse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Horse.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Horse@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Horse@2x.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Horse@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabHorse.imageset/Horse@3x.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Pig1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Pig1@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Pig1@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Pig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Pig1.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Pig1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Pig1@2x.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Pig1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabPig.imageset/Pig1@3x.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Sheep.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "Sheep@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "Sheep@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Sheep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Sheep.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Sheep@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Sheep@2x.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Sheep@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/Assets.xcassets/tabSheep.imageset/Sheep@3x.png -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/ChatLeftMessageCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatLeftMessageCell.swift 3 | // Example 4 | // 5 | // Created by CrazyWisdom on 15/12/25. 6 | // Copyright © 2015年 emqtt.io. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class ChatLeftMessageCell: UITableViewCell { 13 | @IBOutlet weak var contentLabel: UILabel! { 14 | didSet { 15 | contentLabel.numberOfLines = 0 16 | } 17 | } 18 | @IBOutlet weak var avatarImageView: UIImageView! 19 | 20 | override func awakeFromNib() { 21 | super.awakeFromNib() 22 | selectionStyle = UITableViewCell.SelectionStyle.none 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/ChatMessage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatMessage.swift 3 | // Example 4 | // 5 | // Created by CrazyWisdom on 16/1/1. 6 | // Copyright © 2016年 emqtt.io. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class ChatMessage { 12 | 13 | let id: UInt16 14 | let sender: String 15 | let content: String 16 | 17 | init(sender: String, content: String, id: UInt16) { 18 | self.sender = sender 19 | self.content = content 20 | self.id = id 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/ChatRightMessageCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatRightMessageCell.swift 3 | // Example 4 | // 5 | // Created by CrazyWisdom on 16/1/1. 6 | // Copyright © 2016年 emqtt.io. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class ChatRightMessageCell: UITableViewCell { 13 | @IBOutlet weak var contentLabel: UILabel! { 14 | didSet { 15 | contentLabel.numberOfLines = 0 16 | } 17 | } 18 | @IBOutlet weak var avatarImageView: UIImageView! 19 | 20 | override func awakeFromNib() { 21 | super.awakeFromNib() 22 | selectionStyle = UITableViewCell.SelectionStyle.none 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Example/client-keycert.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/Example/Example/client-keycert.p12 -------------------------------------------------------------------------------- /mqtt-client-swift/Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, 10.0 2 | use_frameworks! 3 | 4 | target 'Example' do 5 | pod 'CocoaMQTT/WebSockets', :path => '../' 6 | end 7 | -------------------------------------------------------------------------------- /mqtt-client-swift/LICENSE: -------------------------------------------------------------------------------- 1 | This project is dual licensed under the Eclipse Public License 1.0 and the 2 | Eclipse Distribution License 1.0 as described in the epl-v10 and edl-v10 files. 3 | -------------------------------------------------------------------------------- /mqtt-client-swift/Podfile: -------------------------------------------------------------------------------- 1 | def import_pods 2 | pod 'CocoaAsyncSocket', '~> 7.6.3' 3 | pod 'Starscream', '~> 3.1.1' 4 | 5 | end 6 | 7 | target :'iOS CocoaMQTT' do 8 | platform :ios, '10.0' 9 | use_frameworks! 10 | import_pods 11 | end 12 | 13 | target :'Mac CocoaMQTT'do 14 | platform :osx, '10.12' 15 | use_frameworks! 16 | import_pods 17 | end 18 | 19 | target :'tvOS CocoaMQTT' do 20 | platform :tvos, '10.0' 21 | use_frameworks! 22 | import_pods 23 | end -------------------------------------------------------------------------------- /mqtt-client-swift/Source/CocoaMQTT.h: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaMQTT.h 3 | // CocoaMQTT 4 | // 5 | // Created by CrazyWisdom on 15/12/11. 6 | // Copyright © 2015年 emqx.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for CocoaMQTT. 12 | FOUNDATION_EXPORT double CocoaMQTTVersionNumber; 13 | 14 | //! Project version string for CocoaMQTT. 15 | FOUNDATION_EXPORT const unsigned char CocoaMQTTVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | -------------------------------------------------------------------------------- /mqtt-client-swift/coveralls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source xcenv.sh 4 | declare -r DIR_BUILD="${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}/" 5 | xcode-coveralls "${DIR_BUILD}" 6 | -------------------------------------------------------------------------------- /mqtt-client-swift/edl-v10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-swift/edl-v10 -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Eslint config file 3 | * Documentation: https://eslint.org/docs/user-guide/configuring/ 4 | * Install the Eslint extension before using this feature. 5 | */ 6 | module.exports = { 7 | env: { 8 | es6: true, 9 | browser: true, 10 | node: true, 11 | }, 12 | ecmaFeatures: { 13 | modules: true, 14 | }, 15 | parserOptions: { 16 | ecmaVersion: 2018, 17 | sourceType: 'module', 18 | }, 19 | globals: { 20 | wx: true, 21 | App: true, 22 | Page: true, 23 | getCurrentPages: true, 24 | getApp: true, 25 | Component: true, 26 | requirePlugin: true, 27 | requireMiniProgram: true, 28 | }, 29 | // extends: 'eslint:recommended', 30 | rules: {}, 31 | } 32 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/README.md: -------------------------------------------------------------------------------- 1 | # MQTT Client Wechat miniprogram 2 | 3 | ## 使用 4 | 5 | 克隆或下载该仓库,使用微信小程序导入 `mqtt-client-wechat-miniprogram` 文件夹即可使用 6 | 7 | ![mqtt](./mqtt.png) 8 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/app.js: -------------------------------------------------------------------------------- 1 | // app.js 2 | App({}) 3 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": ["pages/index/index", "pages/logs/logs"], 3 | "window": { 4 | "backgroundTextStyle": "light", 5 | "navigationBarBackgroundColor": "#fff", 6 | "navigationBarTitleText": "MQTT Demo", 7 | "navigationBarTextStyle": "black" 8 | }, 9 | "style": "v2", 10 | "sitemapLocation": "sitemap.json" 11 | } 12 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | padding: 48rpx; 4 | } 5 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/mqtt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/mqtt-client-wechat-miniprogram/mqtt.png -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } 4 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | input, 2 | .received-msg-box { 3 | width: 100%; 4 | border: 1px solid #d7dae1; 5 | border-radius: 8rpx; 6 | padding: 0 20rpx; 7 | box-sizing: border-box; 8 | font-size: 28rpx; 9 | min-height: 64rpx; 10 | margin-bottom: 20rpx; 11 | } 12 | 13 | .received-msg-box { 14 | padding: 20rpx; 15 | min-height: 300rpx; 16 | } 17 | 18 | .label { 19 | font-size: 26rpx; 20 | color: #848587; 21 | margin-bottom: 12rpx; 22 | } 23 | 24 | .is-flex { 25 | display: flex; 26 | justify-content: space-between; 27 | margin-bottom: 20rpx; 28 | } 29 | 30 | button[type="primary"], 31 | button[type="warn"] { 32 | width: 40% !important; 33 | font-size: 28rpx; 34 | font-weight: normal; 35 | margin: 0 !important; 36 | } 37 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/pages/logs/logs.js: -------------------------------------------------------------------------------- 1 | // logs.js 2 | const util = require('../../utils/util.js') 3 | 4 | Page({ 5 | data: { 6 | logs: [] 7 | }, 8 | onLoad() { 9 | this.setData({ 10 | logs: (wx.getStorageSync('logs') || []).map(log => { 11 | return { 12 | date: util.formatTime(new Date(log)), 13 | timeStamp: log 14 | } 15 | }) 16 | }) 17 | } 18 | }) 19 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/pages/logs/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志", 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/pages/logs/logs.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{index + 1}}. {{log.date}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/pages/logs/logs.wxss: -------------------------------------------------------------------------------- 1 | .log-list { 2 | display: flex; 3 | flex-direction: column; 4 | padding: 40rpx; 5 | } 6 | .log-item { 7 | margin: 10rpx; 8 | } 9 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/project.private.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "projectname": "wechat-mqtt-demo", 3 | "setting": { 4 | "compileHotReLoad": true 5 | }, 6 | "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html" 7 | } 8 | -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /mqtt-client-wechat-miniprogram/utils/util.js: -------------------------------------------------------------------------------- 1 | const formatTime = date => { 2 | const year = date.getFullYear() 3 | const month = date.getMonth() + 1 4 | const day = date.getDate() 5 | const hour = date.getHours() 6 | const minute = date.getMinutes() 7 | const second = date.getSeconds() 8 | 9 | return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` 10 | } 11 | 12 | const formatNumber = n => { 13 | n = n.toString() 14 | return n[1] ? n : `0${n}` 15 | } 16 | 17 | module.exports = { 18 | formatTime 19 | } 20 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/layout/history_row.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/basicSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | > 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #9C27B0 4 | #7B1FA2 5 | #7C4DFF 6 | 7 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 180dp 3 | 16dp 4 | 5 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/basicSample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MQTT Example 3 | 4 | 5 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/ActivityConstants.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample 2 | 3 | internal object ActivityConstants { 4 | const val CONNECTION_KEY = "CONNECTION_KEY" 5 | const val CONNECTED = "CONNECTEd" 6 | const val historyProperty = "history" 7 | const val ConnectionStatusProperty = "connectionStatus" 8 | const val empty = "" 9 | } 10 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/StrictApplication.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample 2 | 3 | import android.os.StrictMode 4 | import info.hannes.logcat.LoggingApplication 5 | 6 | class StrictApplication : LoggingApplication() { 7 | 8 | override fun onCreate() { 9 | super.onCreate() 10 | 11 | StrictMode.setThreadPolicy( 12 | StrictMode.ThreadPolicy.Builder() 13 | .detectDiskReads() 14 | .detectDiskWrites() 15 | .detectNetwork() 16 | .penaltyDialog() 17 | .penaltyLog() 18 | .build() 19 | ) 20 | } 21 | } -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/fragments/HomeFragment.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.fragments 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import info.mqtt.android.extsample.R 9 | 10 | class HomeFragment : Fragment() { 11 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 12 | return inflater.inflate(R.layout.fragment_home, container, false) 13 | } 14 | } -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/internal/Action.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.internal 2 | 3 | enum class Action { 4 | CONNECT, DISCONNECT, SUBSCRIBE, PUBLISH 5 | } 6 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/internal/MqttTraceCallback.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.internal 2 | 3 | import info.mqtt.android.service.MqttTraceHandler 4 | import timber.log.Timber 5 | 6 | internal class MqttTraceCallback : MqttTraceHandler { 7 | override fun traceDebug(message: String?) { 8 | Timber.d(message) 9 | } 10 | 11 | override fun traceError(message: String?) { 12 | Timber.e(message) 13 | } 14 | 15 | override fun traceException(message: String?, e: Exception?) { 16 | Timber.e(e, message) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/model/NavDrawerItem.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.model 2 | 3 | import info.mqtt.android.extsample.internal.Connection 4 | 5 | class NavDrawerItem(connection: Connection) { 6 | val title: String = connection.id 7 | val handle: String = connection.handle() 8 | } 9 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/model/ReceivedMessage.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.model 2 | 3 | import org.eclipse.paho.client.mqttv3.MqttMessage 4 | import java.util.* 5 | 6 | class ReceivedMessage(val topic: String, val message: MqttMessage) { 7 | val timestamp: Date = Date() 8 | override fun toString(): String { 9 | return "Received{" + 10 | "topic='" + topic + '\'' + 11 | ", message=" + message + 12 | ", timestamp=" + timestamp + 13 | '}' 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/model/Subscription.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.model 2 | 3 | import info.mqtt.android.service.QoS 4 | 5 | class Subscription(var topic: String, var qos: QoS, var clientHandle: String, var isEnableNotifications: Boolean) { 6 | override fun toString(): String { 7 | return "Subscription{" + 8 | "topic='" + topic + '\'' + 9 | ", qos=" + qos.name + " " + qos.value + 10 | ", clientHandle='" + clientHandle + '\'' + 11 | ", enableNotifications='" + isEnableNotifications + '\'' + 12 | '}' 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/room/Converters.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.room 2 | 3 | import androidx.room.TypeConverter 4 | import info.mqtt.android.service.QoS 5 | 6 | class Converters { 7 | 8 | @TypeConverter 9 | fun toQoS(value: Int) = enumValues()[value] 10 | 11 | @TypeConverter 12 | fun fromQoS(value: QoS) = value.value 13 | } 14 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/room/PersistenceDao.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.room 2 | 3 | import androidx.room.* 4 | import info.mqtt.android.extsample.room.entity.ConnectionEntity 5 | 6 | @Dao 7 | interface PersistenceDao { 8 | 9 | @get:Query("SELECT * FROM ConnectionEntity") 10 | val all: List 11 | 12 | @Insert(onConflict = OnConflictStrategy.REPLACE) 13 | fun insert(connectionEntity: ConnectionEntity): Long 14 | 15 | @Update 16 | fun updateAll(vararg connectionEntities: ConnectionEntity) 17 | 18 | @Delete 19 | fun delete(connectionEntity: ConnectionEntity) 20 | } 21 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/room/SubscriptionDao.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.room 2 | 3 | import androidx.room.* 4 | import info.mqtt.android.extsample.room.entity.SubscriptionEntity 5 | 6 | @Dao 7 | interface SubscriptionDao { 8 | 9 | @get:Query("SELECT * FROM SubscriptionEntity") 10 | val all: List 11 | 12 | @Insert(onConflict = OnConflictStrategy.REPLACE) 13 | fun insert(subscriptionEntity: SubscriptionEntity): Long 14 | 15 | @Update 16 | fun updateAll(vararg entities: SubscriptionEntity) 17 | 18 | @Delete 19 | fun delete(subscriptionEntity: SubscriptionEntity) 20 | } 21 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/room/entity/ConnectionEntity.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.room.entity 2 | 3 | import androidx.room.Entity 4 | import androidx.room.PrimaryKey 5 | import info.mqtt.android.service.QoS 6 | 7 | @Entity 8 | data class ConnectionEntity( 9 | @PrimaryKey var clientHandle: String, 10 | val host: String, 11 | val clientId: String, 12 | val port: Int, 13 | val ssl: Int, 14 | val timeout: Int, 15 | val keepAlive: Int, 16 | val userName: String?, 17 | val userPass: String?, 18 | val cleanSession: Int, 19 | val topic: String?, 20 | val message: String, 21 | val qos: QoS, 22 | val retained: Int 23 | ) 24 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/room/entity/SubscriptionEntity.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.room.entity 2 | 3 | import androidx.room.Entity 4 | import androidx.room.PrimaryKey 5 | import info.mqtt.android.service.QoS 6 | 7 | @Entity 8 | data class SubscriptionEntity( 9 | @PrimaryKey var clientHandle: String, 10 | var topic: String, 11 | var notify: Int, 12 | var qos: QoS 13 | ) 14 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/java/info/mqtt/android/extsample/utils/SubscriptionUtils.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.extsample.utils 2 | 3 | import info.mqtt.android.extsample.model.Subscription 4 | import info.mqtt.android.extsample.room.entity.SubscriptionEntity 5 | 6 | fun SubscriptionEntity.toSubscription(): Subscription = Subscription( 7 | this.topic, 8 | this.qos, 9 | this.clientHandle, 10 | this.notify.toBoolean() 11 | ) 12 | 13 | fun Subscription.toSubscriptionEntity(): SubscriptionEntity = SubscriptionEntity( 14 | this.clientHandle, 15 | this.topic, 16 | this.isEnableNotifications.toInt(), 17 | this.qos 18 | ) 19 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_add.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_cloud_done_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_cloud_done_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_cloud_off_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_cloud_off_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_delete.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_done.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_help.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-hdpi/ic_topic.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_add.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_cloud_done_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_cloud_done_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_cloud_off_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_cloud_off_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_delete.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_done.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_help.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-mdpi/ic_topic.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_add.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_cloud_done_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_cloud_done_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_cloud_off_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_cloud_off_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_delete.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_done.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_help.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_logcat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_logcat.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xhdpi/ic_topic.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_add.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_cloud_done_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_cloud_done_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_cloud_off_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_cloud_off_dark.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_delete.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_done.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_help.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable-xxhdpi/ic_topic.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable/paho_logo_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/drawable/paho_logo_full.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/layout/switch_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/layout/tab_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/layout/text_select.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/layout/toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/menu/menu_connection.xml: -------------------------------------------------------------------------------- 1 | 5 | 11 | 12 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/menu/menu_edit_connection.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/extendedSample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #A257A0 4 | #AB1FA2 5 | 6 | #212121 7 | #727272 8 | #00B6B6 9 | #8C4DFF 10 | #000000 11 | 12 | 13 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 260dp 6 | 7 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1883 4 | 60 5 | 200 6 | 7 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/extendedSample/src/main/res/values/text_select_values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 3 | install: 4 | - ./gradlew :serviceLibrary:build :serviceLibrary:publishToMavenLocal -x :serviceLibrary:test 5 | - find . -name "*.aar" -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/androidTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/androidTest/assets/test.bks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emqx/MQTT-Client-Examples/b42106f8bf1eb6a78a612ce156a420f981fee689/paho.mqtt.android-kotlin/serviceLibrary/src/androidTest/assets/test.bks -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/androidTest/assets/test.properties: -------------------------------------------------------------------------------- 1 | # This is the server URI which will be set in the constructor of an MQTT Client 2 | # The default is "tcp://:1883" with expressed in IPV4 dotted decimal notation 3 | SERVER_URI=tcp://broker.hivemq.com:1883 4 | SERVER_SSL_URI=ssl://broker.hivemq.com:8883 5 | CLIENT_KEY_STORE=test.bks 6 | CLIENT_KEY_STORE_PASSWORD=mqtttest 7 | WAIT_FOR_COMPLETION_TIME=6000 8 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/Ack.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service 2 | 3 | import org.eclipse.paho.client.mqttv3.MqttCallback 4 | 5 | enum class Ack { 6 | /** 7 | * As soon as the [MqttCallback.messageArrived] returns, the message has been acknowledged as received . 8 | */ 9 | AUTO_ACK, 10 | 11 | /** 12 | * When [MqttCallback.messageArrived] returns, the message 13 | * will not be acknowledged as received, the application will have to make an acknowledgment call 14 | * to [MqttAndroidClient] using [MqttAndroidClient.acknowledgeMessage] 15 | */ 16 | MANUAL_ACK 17 | } -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/MqttServiceBinder.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service 2 | 3 | import android.os.Binder 4 | 5 | class MqttServiceBinder(val service: MqttService) : Binder() { 6 | 7 | var activityToken: String? = null 8 | 9 | } 10 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/MqttTraceHandler.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service 2 | 3 | interface MqttTraceHandler { 4 | 5 | fun traceDebug(message: String?) 6 | 7 | fun traceError(message: String?) 8 | 9 | fun traceException(message: String?, e: Exception?) 10 | } 11 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/QoS.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service 2 | 3 | enum class QoS(val value: Int) { 4 | 5 | AtMostOnce(0), 6 | AtLeastOnce(1), 7 | ExactlyOnce(2); 8 | 9 | companion object { 10 | @JvmStatic 11 | fun valueOf(qos: Int): QoS { 12 | return values()[qos] 13 | } 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/Status.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service 2 | 3 | enum class Status { 4 | OK, 5 | ERROR 6 | } 7 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/room/Converters.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service.room 2 | 3 | import androidx.room.TypeConverter 4 | import info.mqtt.android.service.QoS 5 | import org.eclipse.paho.client.mqttv3.MqttMessage 6 | 7 | class Converters { 8 | 9 | @TypeConverter 10 | fun toQoS(value: Int) = enumValues()[value] 11 | 12 | @TypeConverter 13 | fun fromQoS(value: QoS) = value.value 14 | 15 | @TypeConverter 16 | fun toMqttMessage(value: String): MqttMessage = MqttMessage(value.toByteArray(Charsets.UTF_8)) 17 | 18 | @TypeConverter 19 | fun fromMqttMessage(value: MqttMessage): String = value.payload.toString(Charsets.UTF_8) //.decodeToString() 20 | } 21 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/java/info/mqtt/android/service/room/entity/MqMessageEntity.kt: -------------------------------------------------------------------------------- 1 | package info.mqtt.android.service.room.entity 2 | 3 | import androidx.room.Entity 4 | import androidx.room.Index 5 | import androidx.room.PrimaryKey 6 | import info.mqtt.android.service.QoS 7 | import org.eclipse.paho.client.mqttv3.MqttMessage 8 | 9 | @Entity(indices = [Index(value = ["clientHandle"])]) 10 | data class MqMessageEntity( 11 | @PrimaryKey val messageId: String, 12 | var clientHandle: String, 13 | var topic: String, 14 | var mqttMessage: MqttMessage, 15 | val qos: QoS, 16 | val retained: Boolean, 17 | val duplicate: Boolean, 18 | val timestamp: Long 19 | ) 20 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/serviceLibrary/src/proguard-sdk.pro: -------------------------------------------------------------------------------- 1 | -keep class info.mqtt.android.service.** { *;} -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'MQTT-Android' 2 | 3 | include ':serviceLibrary' 4 | include ':extendedSample' 5 | include ':basicSample' 6 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/test/tls-testing/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-mosquitto:latest 2 | COPY mosquitto-docker.conf /mosquitto/config/mosquitto.conf 3 | COPY keys /mosquitto/config/keys 4 | -------------------------------------------------------------------------------- /paho.mqtt.android-kotlin/test/tls-testing/mosquitto.pw: -------------------------------------------------------------------------------- 1 | test_user:$6$PY1pf+FdPmONSyhb$gC0yIykOSqj5x2rY7odzhNqLrQJ1S7dpQAgvxK+DXKquw1Yp5whSSgfcv24xTIotm3KCt1D6vcISOq/m3OhGEg== 2 | testuser:$6$VsVwgoeK2yQI5QTo$2fSqD6qUgMvfSOQQxRm7aQH1sA2oqGmdbNFM86GBbjWja7sN5wxOQHIjk/B8PeOqmMOee5UWX2faXy+X9fPZ4w== 3 | Admin:$6$OAKIhJgkrZUTDSbN$AmKUUznotPbGl5XaFbs8wqw4OyWFkjOgxJfJ4C/9vaknsouvR4RmsEozCee2SPwFaXSR52QRype/9+iSvU7y5w== 4 | username:$6$djEZwC47JvyetTxD$8x/J3ClUe38pcxE55hRw/uTpulVOCH6yXwJzJI6SPgmIdSGXAPtoEFLhKeXzoN20P1W30NUpgcIRI716lCYWVw== 5 | --------------------------------------------------------------------------------