ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

WebSocketProvider in FallbackProvider causes polling

Open jacobmakarsky opened this issue 11 months ago • 1 comments

Suggestion

When using a WebSocketProvider within a FallbackProvider, any event listeners attached to the FallbackProvider will use polling instead of WebSocket subscriptions. For real-time event subscriptions, create listeners directly on the WebSocketProvider instance instead.

"A WebSocket provider is fully capable as a stateless (making individual RPC calls) provider, so when passed to fallback provider, it simple uses its stateless API. But the value of the WebSocketProvider in general is its statefulness (maintaining an ongoing connection to receive realtime events/updates like eth_subscribe)."

See https://discord.com/channels/717003406484701255/717009571536699571/1332489217665929237 in the ethers discord for further context.

jacobmakarsky avatar Jan 24 '25 23:01 jacobmakarsky

Can i solve this issue please

sehgalaayu avatar Jun 30 '25 07:06 sehgalaayu