MQTT using domain name

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQTT using domain name

4,157件の閲覧回数
jakarman12
Contributor I

Hi guys,

I'm learning MQTT and I'm following BlackNight example.

MQTT Example

Is there an example of how to connect using the domain name of the MQTT broker?

This is because the IP of the broker I am using is dynamic.

Regards

Jordan García

タグ(3)
0 件の賞賛
4 返答(返信)

2,697件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Jordan:

Just an information that MQX 5 supports MQTT and REST. But it is under commercial licensing terms.

MQX™ v5 Software Solutions|NXP 

Regards

Daniel

0 件の賞賛

2,697件の閲覧回数
mjbcswitzerland
Specialist V


Hi Jordan

There is another MQTT implementation described here that you could also try - it is also open source: https://community.nxp.com/message/994806 but allows you to run on any Kinetis part and also in its Kinetis simulator for easier analysis and testing.
Documentation: http://www.utasker.com/docs/uTasker/uTasker_MQTT.pdf
Video: https://youtu.be/-_CV2aXHyjw

The DNS part is a separate process that is performed before starting the connection. It can be done as following in the uTasker implementation (example of connecting to "test.mosquitto.org"):

fnResolveHostName("test.mosquitto.org", fnDNSListner);                   // resolve broker's address

static void fnDNSListner(unsigned char ucEvent, unsigned char *ptrIP)    // called when DNS resolution has completed
{
    unsigned char ucBroker[IPV4_LENGTH];
    switch (ucEvent) {
    case DNS_EVENT_SUCCESS:                                              // the address has been successfully resolved
        uMemcpy(ucBroker, ptrIP, IPV4_LENGTH);                           // save the IP address which has just been resolved
        fnConnectMQTT(ucBroker, fnMQTT_callback, (UNSECURE_MQTT_CONNECTION | MQTT_CONNECT_FLAG_CLEAN_SESSION)); // establish MQTT connection
        break;
    default:                                                             // DNS error message
        break;
    }
}

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

0 件の賞賛

2,697件の閲覧回数
jakarman12
Contributor I

Hello Mark,

Do you have a complete example that you can modify?

If I need TLS, does it cost?

Regards

0 件の賞賛

2,697件の閲覧回数
mjbcswitzerland
Specialist V

Hi Jordan

There is a command line interface application as described in the manual and I also added code to allow publishing data received from an nRF24L01 radio connection as described here
https://community.nxp.com/message/999272?commentID=999272#comment-999272

Presently I have offered the MQTT implementation to the open source community but MQTTS (TLS) is presently reserved for licensees (who finance several months of development to be able to realise the quality required) who then have personal support.

Otherwise you could use Amazon FreeRTOS (where there is an MQTT/TLS application) since you may be able to port it to a Kinetis with a few days work, depending on your experience. I think that Eric also has something working with mbedTLS if you prefer that route.

Regards

Mark

uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

0 件の賞賛