Published Message from server program, but not received by application

Hi,

I am using MQTT on my server program and front-end application (Windows, Android, and iOS).

Here is general connection setting:
On server program, I use wss://[Cluster URL]:[Web Port]/mqtt to connect to MQTT
On application, I use MqttServerClient.withPort(‘[Cluster URL]’, ‘[TCP Port]’).

I tested with 3 platforms:

  1. Server program
  2. Front-end app
  3. Web Client by HiveMQ
    All three platforms has one same topic.

Here are how I tested:

  1. When Web Client published the message and app received an message successfully.
  2. Then, when server program published the message and app did NOT receive it. However, Web Client received the message.
  3. Then, when Web Client published the message again, app did NOT receive a message.

I am not sure why Web Client can receive the message, but not on the app.
Is it a port issue? cluster host issue?

Looking forward to get help.

Thanks,

Here are the test cases:

  1. Web Client → app (Message received successfully)
  2. Then, Web Client → app (Message received successfully)
  3. Then, server program → app & Web Client (app did NOT receive message, Web Client received successfully)
  4. Then, Web Client → app (app did NOT receive message)

Restarted the app.

  1. Then, server program → app & Web Client (app did NOT receive message, Web Client received successfully)
  2. Then, Web Client → app (app did NOT receive message)

Restarted the app.

  1. Web Client → app (Message received successfully)
  2. Then, server program → app & Web Client (app did NOT receive message, Web Client received successfully)
  3. Then, Web Client → app (app did NOT receive message)

Hi sback2063,

This almost sounds like the “app” is not staying connected after receiving one message sent to the topic. Do you have any logging on the app that could validate if it is disconnecting and not reconnecting?

Also, what happens if you try this test case:

Starting the app fresh, publish from server with only the app as a subscriber (no web app subscriber)

(only case that seemed “missing” to me from your last post, unless I misread one of them)​

Thanks,
Seth - HiveMQ Support

Hi support,

Thank you for your response.

I will check out the log and get back to you on this.

Perhaps, I connected wss one side and tcp on another side?
Will this be the reason?

Thanks,

Hi @sback2063 ,

As soon as you have connected to the same HiveMQ broker cluster (i.e. hostname), no, all messages should pass through.

If you are unsure whether the reason is your client app or the broker, we encourage you to test using MQTT CLI. You can use it from your desktop or laptop machine. You will need an OpenJDK 11 or later to run it. For “installation” of the MQTT CLI you just need to download the ZIP archive from the GitHub repo’s Releases, un-archive it to a directory and you can use it.

For example, in one terminal window, you can subscribe to the topic filter # (all topics):

mqtt subscribe --topic # \
  --identifier MySubscriber \
  --host 111222333444555666777888999000aaa.s1.eu.hivemq.cloud --port 8883 \
  --secure \
  --user MyUsername --password MyPassword \
  --jsonOutput \
  --verbose 

In another terminal window(!), you can publish a message and see if that reaches the MySubcriber client:

mqtt publish --topic Test --message Hello \
  --identifier MyPublisher \
  --host 111222333444555666777888999000aaa.s1.eu.hivemq.cloud --port 8884 -ws \
  --secure \
  --user MyUsername --password MyPassword \
  --verbose

I hope it helps
Kind regards,
Dasha from HiveMQ Team