near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.32k stars 621 forks source link

Subscribing to new blocks #6681

Open dunidaho75 opened 2 years ago

dunidaho75 commented 2 years ago

Hello,

In tendermint, one can subscribe to new blocks/events via a websocket subscription as mentioned here: https://docs.tendermint.com/master/tendermint-core/subscription.html

Is there a corresponding equivalent functionality for NEAR? Best I could find was: https://docs.near.org/docs/tools/near-indexer-framework which seems like a lot more heavy lifting for something relatively simple like a websocket.

There is also a NEAR Lake option as described here (https://gov.near.org/t/announcement-near-lake-framework-brand-new-word-in-indexer-building-approach/17668) where one could listen to events from an S3 bucket. This seems a bit weird approach where a decentralised network approach is relying on web2 services.

Thanks.

janewang commented 2 years ago

Unfortunately we do not current support subscription of events via websocket. This is an item on our roadmap. Added to our backlog.

bowenwang1996 commented 2 years ago

This is an item on our roadmap

On which team's roadmap? cc @frol @AustinBaggio

frol commented 2 years ago

In tendermint, one can subscribe to new blocks/events via a websocket subscription as mentioned here: https://docs.tendermint.com/master/tendermint-core/subscription.html

While it is simple, this seems completely useless to me. What do you do when you need to restart your service and/or your service went offline? How to go over the blocks that you missed?

Is there a corresponding equivalent functionality for NEAR? Best I could find was: https://docs.near.org/docs/tools/near-indexer-framework which seems like a lot more heavy lifting for something relatively simple like a websocket.

Treat Indexer Framework as a low-level implementation and Lake Indexer as a user-friendly approach. For user convenience we even build typed versions of the client frameworks (Rust is quite solid, TypeScript/JavaScript is under review)

There is also a NEAR Lake option as described here (https://gov.near.org/t/announcement-near-lake-framework-brand-new-word-in-indexer-building-approach/17668) where one could listen to events from an S3 bucket. This seems a bit weird approach where a decentralised network approach is relying on web2 services.

You seem to forget that using websocket you rely on some centralized server that serves that websocket for you. In order to be decentralized, you need to run your own node and query it, and Indexer Framework does exactly that for you, but you don't seem to be interested in running a full node yourself, don't you?

@dunidaho75 I feel we can close this issue as all the tools are already in place. Please, refer to near-indexers.io documentation for more details. What do you think?