-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
When developers or apps connect to the WebSocket port of the Relay, they expect to leverage at least the same functionalities offered by the HTTP port, in addition to the WS specific ones (i.e. subscription).
At the moment, that expectation is not fulfilled and developers/applications can discover later in the process that a specific method is not supported by the WS connection. Because the application cannot use a dynamic failover to the HTTP version (subscription should become polling, etc.) this forces the applications to always use the HTTP server if they want to be sure everything will work.
This is an example with the eth_feeHistory method:
➜ echo '{"method":"eth_feeHistory","params":["0x4", "latest", [25, 75]],"id":1,"jsonrpc":"2.0"}' | websocat wss://testnet.hashio.io/ws
{"error":{"code":-32601,"message":"[Request ID: 1056199a-6e67-4b36-bbe9-7b4cfb48a7ad] Method eth_feeHistory not found"},"jsonrpc":"2.0","id":1}
➜ curl https://testnet.hashio.io/api -X POST -H "Content-Type: application/json" --data '{"method":"eth_feeHistory","params":["0x4", "latest", [25, 75]],"id":1,"jsonrpc":"2.0"}'
{"result":{"baseFeePerGas":["0xe680992c00","0xe680992c00","0xe680992c00","0xe680992c00","0xe680992c00"],"gasUsedRatio":[0.5,0.5,0.5,0.5],"oldestBlock":"0x1da5d11","reward":[["0x0","0x0"],["0x0","0x0"],["0x0","0x0"],["0x0","0x0"]]},"jsonrpc":"2.0","id":1}Solution
- The WebSocket connection should be just another way to access the same functionalities offered by the HTTP server.
- All methods provided by the Relay and not strictly related to the HTTP/WS protocol (i.e. subscribe, unsubscribe) should be offered on both HTTP and WS connections.
Alternatives
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request