Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ntcore] Server requires subscription for announce, no response on publish #7680

Open
cjlawson02 opened this issue Jan 14, 2025 · 3 comments
Labels
type: bug Something isn't working.

Comments

@cjlawson02
Copy link

cjlawson02 commented Jan 14, 2025

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:

  1. Publish a topic to the server without subscribing to it:
    [{"method":"publish","params":{"type":"string","name":"/MyTable/autoMode","pubuid":973718445,"properties":{}}}]
  2. Observe that no announce response is received.
  3. Then, send a subscription request for the same topic:
    [{"method":"subscribe","params":{"topics":["/MyTable/autoMode"],"subuid":25935943,"options":{}}}]
  4. Notice that the server now sends an announce response containing the pubuid:
    [{"method":"announce","params":{"id":59,"name":"/MyTable/autoMode","properties":{},"pubuid":973718445,"type":"string"}}]
  5. 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

@PeterJohnson
Copy link
Member

Thanks for the report. I noticed the spec also needs updating to clarify in both the subscribe and announce message sections that announce is sent in response to a subscribe message for existing topics that have not yet been announced to the client. This was an oversight when we changed the spec from announcing on connection to announcing on subscribe.

@cjlawson02
Copy link
Author

Does this mean that the client will receive announcements for topics it hasn't requested a subscription for? I was under the impression that new announcements are only sent when the subscription is created, when a topic starts publishing, or when a prefix topic has a new subtopic.

@PeterJohnson
Copy link
Member

PeterJohnson commented Jan 14, 2025

No--your original impression is correct. The spec just doesn't say it does the "when the subscription is created" part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants