8

Most of centralized exchanges support websocket based APIs to stream data to users efficiently. Can we implement the same feature using EOS.IO platform?

4 Answers 4

2

As long as the EOS nodes are open source, we can always create plugins for it in C++. So I think it's a good idea to create a plugin that enables the running node to serve websockets connections in a pub/sub fashion.

(Not sure EOS Core team already have plans or are building that)

3
  • In case I create a plugin, block producers need to adopt it and run it for me right? Would it be possible to do something without the help of EOS core team? May 17, 2018 at 17:22
  • no, actually you will run your own node connected to the mainnet but not as a producer May 17, 2018 at 18:18
  • 1
    Thank you for the answer! Then I need to run my centralized full nodes and may need to come up with some incentive scheme if I want other people running those nodes for my application. Is my understanding correct? May 18, 2018 at 14:22
3

You can create a nodejs app (for example) that watches incoming blocks from EOSIO. Probably would be a good idea to create a 'cache' database for more streamlined "reading" not to query the eosio node every time.

Your nodejs app can have socket connections available for your end users.

1
  • In this case, I think I need to host my nodejs app in a centralized environment. Am I correct? Would there be any decentralized way to do this? May 17, 2018 at 17:20
2

That's a really good question. Blockchain development is awesome but we have to find ways to build great experiences around it. We're asking the same type of questions as we're building our Carmel product (carmel.io) and the way we're implementing this is by building a hybrid architecture, using EOS, Ethereum, AWS Lambda and Firebase on the backend and React on the frontend. In this setup, we can have our backend talk to the two blockchains in the background and store key information in our Firebase Realtime Database, than React clients (web, mobile, desktop) can subscribe to and receive realtime events. Such as wallet balances, transaction history, etc.

I think that's the cleanest way of doing things, without touching the actual EOS core source code and it seems to be working well for us so far. Definitely stay tuned for updates on that though :)

1
  • Thank you for your answer! I would like to have a decentralized implementation though. :) May 17, 2018 at 17:18
2

If you want a websockets API that streams current blocks, but also past blocks, and allows you to filter actions, but also table changes.. check out https://dfuse.io .. just released!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.