[ntcore] Server requires subscription for announce, no response on publish #7680
Description
Describe the bug
Hi team, when a client publishes a topic, it does not receive an announce
response from the server unless the client is also subscribed to the same topic. According to the protocol spec, the server should send an announce
in response to a client's publish
message. Additionally, WebSocket pings and pongs are not exchanged until a subscription is made.
To Reproduce
Steps to reproduce the behavior:
- Publish a topic to the server without subscribing to it:
[{"method":"publish","params":{"type":"string","name":"/MyTable/autoMode","pubuid":973718445,"properties":{}}}]
- Observe that no
announce
response is received. - Then, send a subscription request for the same topic:
[{"method":"subscribe","params":{"topics":["/MyTable/autoMode"],"subuid":25935943,"options":{}}}]
- Notice that the server now sends an
announce
response containing thepubuid
:[{"method":"announce","params":{"id":59,"name":"/MyTable/autoMode","properties":{},"pubuid":973718445,"type":"string"}}]
- Observe that WebSocket pings and pongs also begin only after the subscription.
Expected behavior
The client should receive an announce
response from the server immediately after publishing a topic, regardless of whether it is subscribed to that topic. Additionally, WebSocket pings and pongs should occur as expected without requiring a subscription.
Desktop (please complete the following information):
- OS: macOS
- Project Information: Getting Started example simulator on Java 17, WPILib 2025.2.1
Additional context
The lack of an announce
response for published topics without a subscription can cause issues for clients expecting confirmation or awareness of the topic they just published. The dependency on subscriptions for WebSocket ping/pong behavior might also indicate a related issue in connection handling.
Wireshark dump for further debugging: NTCoreWiresharkDump.zip