joshstevens19 / rindexer

A no-code blazing fast EVM indexer tool built in rust.
https://rindexer.xyz
MIT License
265 stars 24 forks source link

Websocket Support #44

Open hskang9 opened 1 month ago

hskang9 commented 1 month ago

Hello team, I make fully onchain orderbook exchange with indexer on javascript, but I feel nervous that my indexer will not catch up to the speed when many users start to use it.

indexer repo

Then I see this rust indexer which is expected to integrate in rust. I am amazed to use this, but I want to see websocket support and guide on docs as I realized orderbook exchange only could work with subscription on trading event.

Could you please add websocket support in your project milestone?

joshstevens19 commented 1 month ago

so you want to supply a WS node instead of HTTP? would you expect it to listen to the WS for new data or would you be ok with it just doing the JSONRPC requests using the WS node?

hskang9 commented 1 month ago

Actually both WS node and HTTP node is needed. In Ponder, I use separate port for just listening to new events. Here is the issue I requested in ponder just to include socket.io’s io.

link

If this indexer follows design from Ponder, I hope it includes websocket object to emit events after spinning up transports and listening port in the config file. My fully decentralized onchain CLOB app gets current data with http GraphQL request, then updates the new data with websocket subscription to the indexer. This way, it is more efficient than sending http request periodically to the indexer for every 2~6 seconds. Periodically asking OHLCV information by 17k users in an event drastically increased server cost at the unsustainable level. To answer your question on usage of websocket, I would prefer listening to the WS for new data.

nuts-rice commented 1 month ago

We'd need to migrate to alloy for this, as the Ws provider module for ethers is being deprecated , I believe #1 would be where to start with WS support

joshstevens19 commented 1 month ago

Yep need to take the hit and do it @nuts-rice