Forum
No internet connection
  1. Home
  2. General Discussion

Changing mqtt uri prefix[WISE-PaaS/EnSaaS DB Service]

By Nicholas Teo Yong Yeow @nicholastyy_wg18
    2021-07-31 08:09:57.140Z

    Currently, I am trying to write an android application that connects to an mqtt broker to subscribe and publish topics. In my research, I've found out that the library I am using (paho mqtt library: https://eclipse.github.io/paho.mqtt.c/MQTTClient/html/struct_m_q_t_t_client__connect_options.html) only accepts uris that start with 'tcp://' or 'ssl://'. The mqtt uri in the rabbitMQ secret starts with the prefix mqtt:// so I am unable to use it in the application at the moment.

    Is there a way to get a uri that starts with 'tcp://'? I have tried just changing the prefix of the existing rabbitMQ uri from mqtt to tcp, but that ends up with the application crashing.

    Thank you

    • 3 replies
    1. Y
      Yien Liu @Yien_Liu
        2021-08-02 02:18:30.542Z

        Hi,
        According to the documentation you provide, the format of URIs should be like this:

        protocol://host:port

        And the host should be the "host" in the rabbitMQ secret, e.g rabbitmq.wise-paas.com

        So the full URI should be tcp://rabbitmq.wise-paas.com:1883

        1. N

          Hi, I tried that but I get a new set of errors.

          I'm not sure why this is happening, because when I tried it with a difference public broker (broker.hivemq.com) it worked perfectly fine.

          ^These are the 4 links that the error message leads to

          1. Oh, and I tried with with both the normal host and external host. Thats why there's a 'pub' in the rabbitmq uri