-
Notifications
You must be signed in to change notification settings - Fork 0
Home
HugoAVaz edited this page Sep 5, 2022
·
4 revisions
The MQTT namespace enables MQTT communication within your development. There is already in place an MQTT Managed client.
-
Add the necessary namespaces in your project
using Coreflux.API.Networking.MQTT;
-
Call the managed mqtt client from Coreflux
MQTTController.Start("127.0.0.1", 1883);
//using IP with normal TCP/IP socket
MQTTController.Start("cloud.coreflux.org", 1883);
//using dns with normal TCP/IP socket
MQTTController.Start("cloud.coreflux.org:8080/mqtt", 8080, "", "", false, true);
//using dns , without username "", no password , no TLS and with websocket
- Connect the events
MQTTController.NewPayload += this.MQTTController_NewPayload;
//Provides a standard reception of subscribed topics
This is asynchronous usage
- Subscribe
string payload=MQTTController.GetData("mytopic/teste");
// provides the payload of a topic directly from the cache of the managed mqtt client
This is synchronous usage
- Publish
MQTTController.SetData("mytopic/teste", "payload", 0, false);
// Publishes the value to the topic with the payload . In this case without retain(false) and QOS 0.
- Windows 11 (pre-release tested) , 10, IoT , 7
- Linux ( Ubuntu , Raspian, Debian,etc..)
- Android (Phones,SmartTVs)
- IOs
- macOS
- MQTT 3.1 / 3.1.1 /5.00
There is a nuget package available Coreflux Nuget
http://coreflux.org - Coreflux the most advanced industrial IOT platform!