Skip to content

Conversation

@NikolasHaimerl
Copy link
Contributor

@NikolasHaimerl NikolasHaimerl commented Jan 7, 2026

We want to be able to control which indexer is using what RPC URLs, this is both because Websockets are not equally well supported by all RPC providers and we want to know the Websocket specific RPC usage, which means we have to separate the keys being used by the Websocket and poll based indexer.
Related to https://github.com/UMAprotocol/zion/pull/1153


if (process.env.ENABLE_WEBSOCKET_INDEXER === "true") {
const allProviders = parseEnv.parseProvidersUrls();
const allProviders = parseEnv.parseProvidersUrls("WS_RPC_PROVIDER_URLS_");
Copy link
Contributor

@amateima amateima Jan 7, 2026

Choose a reason for hiding this comment

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

Is there a way to keep using RPC_PROVIDER_URLS_ as a fallback? It would be ideal to not redeclare the RPC URL if the existing one used for polling works as expected for ws as well. Basically use WS_RPC_PROVIDER_URLS_ as a override only if declared and needed 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm is there a way to know whether an RPC URL works for a websocket before seeing if the websocket looses it's connection?

Copy link
Contributor Author

@NikolasHaimerl NikolasHaimerl Jan 7, 2026

Choose a reason for hiding this comment

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

I could do something like this:

const rpcProviders = parseEnv.parseProvidersUrls("RPC_PROVIDER_URLS_");
const wsProviders = parseEnv.parseProvidersUrls("WS_RPC_PROVIDER_URLS_");
// Merge providers, allowing WS providers to override RPC providers if defined for a chain
const allProviders = new Map([...rpcProviders, ...wsProviders]);

Does this address what you had in mind?

Copy link
Contributor

@amateima amateima Jan 8, 2026

Choose a reason for hiding this comment

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

Hm is there a way to know whether an RPC URL works for a websocket before seeing if the websocket looses it's connection?

I don't think so.

Copy link
Contributor

Choose a reason for hiding this comment

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

I could do something like this:

const rpcProviders = parseEnv.parseProvidersUrls("RPC_PROVIDER_URLS_");
const wsProviders = parseEnv.parseProvidersUrls("WS_RPC_PROVIDER_URLS_");
// Merge providers, allowing WS providers to override RPC providers if defined for a chain
const allProviders = new Map([...rpcProviders, ...wsProviders]);

Does this address what you had in mind?

Something like this, yes.

 const allProviders = new Map([...rpcProviders, ...wsProviders]);

Here order matters, right? Basically wsProviders is overriding rpcProviders because it comes after

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that was the intention, wsProviders overwrites rpcProviders.

Copy link
Contributor Author

@NikolasHaimerl NikolasHaimerl Jan 8, 2026

Choose a reason for hiding this comment

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

Copy link
Contributor

@amateima amateima left a comment

Choose a reason for hiding this comment

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

🚀

@NikolasHaimerl NikolasHaimerl merged commit 972cde3 into stage Jan 9, 2026
3 checks passed
NikolasHaimerl added a commit that referenced this pull request Jan 15, 2026
NikolasHaimerl added a commit that referenced this pull request Jan 18, 2026
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.

3 participants