Skip to content

feat(hermes-server) Add ignore_invalid_price_ids flag to hermes ws endpoint #2599

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

bplatak
Copy link
Contributor

@bplatak bplatak commented Apr 22, 2025

Summary

Add a new flag ignore_invalid_price_ids to WebSocket subscriptions that enables partial subscriptions when some price IDs are invalid. When enabled, Hermes will establish the WebSocket connection and stream updates only for the valid price IDs while silently ignoring any invalid ones. This enhancement aligns the WebSocket API behaviour with the existing REST API functionality introduced in #2091.

Rationale

This change simplifies integration for clients who need to subscribe to multiple price feeds but don't require all of them to be valid. Current workarounds are suboptimal:

  1. Sending individual subscription requests for each ID (increasing connection overhead)
  2. Attempting a bulk subscription, parsing error messages to identify invalid IDs, then retrying with filtered IDs

The new flag provides a more efficient solution by allowing clients to subscribe to all desired price feeds in a single request while gracefully handling any invalid IDs. This reduces implementation complexity for clients and improves connection efficiency by eliminating the need for multiple subscription attempts or error handling logic.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Copy link

vercel bot commented Apr 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Apr 22, 2025 2:10pm
component-library ⬜️ Ignored (Inspect) Apr 22, 2025 2:10pm
entropy-debugger ⬜️ Ignored (Inspect) Apr 22, 2025 2:10pm
insights ⬜️ Ignored (Inspect) Apr 22, 2025 2:10pm
proposals ⬜️ Ignored (Inspect) Apr 22, 2025 2:10pm
staking ⬜️ Ignored (Inspect) Apr 22, 2025 2:10pm

Copy link
Contributor

@merolish merolish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any corresponding docs that need to be updated?

} else {
for price_id in price_ids {
for price_id in found_price_ids {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth warn logging any not found ids, I assume.

Copy link
Collaborator

@ali-bahjati ali-bahjati Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not a warn for us, but maybe an warn message to the client would be good (as an error response). not necessary though.

@tejasbadadare
Copy link
Contributor

tejasbadadare commented Apr 22, 2025

Are there any corresponding docs that need to be updated?

@merolish The WS endpoint is undocumented since we want the public to use the SSE endpoint instead. And that one already supports this flag.

@bplatak bplatak merged commit c68c309 into main Apr 23, 2025
9 checks passed
@bplatak bplatak deleted the feat/hermes/server/ws-ignore-invalid-ids branch April 23, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants