Why is it possible to listen to JSON-RPC events even though ethereum node working under HTTP?

Viewed 197

eth_subscribe method of JSON-RPC API requires a full duplex connection, such as WebSocket, hence subscribing to events is impossible via a HTTP connection.

I use Ganache as an ethereum node and Metamask as a browser provider to test my dapp. The Ganache server is listening to requests by means of HTTP. Nevertheless, the dapp have no glitches to receive notifications from the provider after subscription with eth_subscribe.

Have I got it right that Metamask, being encountered with a HTTP server, trys to get its events through any other way (like polling) deep under the hood? And then a dapp developer should not worry about whether the user's node supports duplex conections or not - as long as there is a Metamask provider. Or it's all Ganache - does it just support WebSockets?

I failed to find any clarification on this issue in the docs.

0 Answers
Related