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:
Server program
Front-end app
Web Client by HiveMQ
All three platforms has one same topic.
Here are how I tested:
When Web Client published the message and app received an message successfully.
Then, when server program published the message and app did NOT receive it. However, Web Client received the message.
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?
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)
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):