# Published Message from server program, but not received by application

**URL:** <https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695>\
**Category:** Uncategorized\
**Created:** [December 21, 2022, 4:40pm UTC](https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695 "2022-12-21T16:40:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sback2063](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sback2063](https://community.hivemq.com/u/sback2063)\
**Post date:** [December 21, 2022, 4:40pm UTC](https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695/1 "2022-12-21T16:40:02Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![sback2063](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sback2063](https://community.hivemq.com/u/sback2063)\
**Post date:** [December 21, 2022, 4:54pm UTC](https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695/2 "2022-12-21T16:54:51Z")

</div>

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** _)

---

<div class="post-metadata">

**Author:** ![hivemq-support](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/hivemq-support/32/357_2.png) [@hivemq-support](https://community.hivemq.com/u/hivemq-support)\
**Post date:** [December 28, 2022, 8:14pm UTC](https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695/3 "2022-12-28T20:14:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sback2063](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sback2063](https://community.hivemq.com/u/sback2063)\
**Post date:** [December 29, 2022, 1:58pm UTC](https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695/4 "2022-12-29T13:58:32Z")

</div>

> [@hivemq-support](#):
>
> Do you have any logging on the app that could validate if it is disconnecting and not reconnecting

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,

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [December 29, 2022, 4:26pm UTC](https://community.hivemq.com/t/published-message-from-server-program-but-not-received-by-application/1695/5 "2022-12-29T16:26:23Z")

</div>

Hi @sback2063 ,

> [@sback2063](#):
>
> Perhaps, I connected **wss** one side and **tcp** on another side?  
> Will this be the reason?

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](https://hivemq.github.io/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):

```auto
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:

```auto
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
