B4J Question Keeping B4XTable Up-To-Date with Websocket Streaming Data--Best Way To Do It?

cklester

Well-Known Member
Licensed User
Need help figuring out a fast and efficient way to update a B4XTable* with websocket data.

I'm exploring algorithms right now for getting the updated data into the B4XTable.

It would be great if when I updated some collection (i.e., a map, custom type, etc.), the B4XTable would automatically update as well. Is that kind of functionality possible? myMap_Updated()? šŸ˜

Otherwise, if anybody has any good ideas, please share!

Example of the JSON string I receive from the websocket:

B4X:
{"exchange":"binance","pair":"eth-btc","channel":"orderbook","snapshot":true,"sequence":849,"content":{"asks":[{"price":"0.08363500","quantity":"2.21140000"}],"bids":[{"price":"0.08418600","quantity":"5.47350000"}]}}

I'll need to update the row corresponding to the "pair" value. The columns are updated with the "asks" and "bids" data.

It seems the step-by-step would be:
  1. Get the row to be modified (find it with "pair")
  2. Get the column(s) to be modified ("content" contains the values I need)
  3. Use B4XTable1.sql1... to update the underlying sqlite record
  4. Use B4XTable1.UpdateTableCounters
Is that the best way? Is that the common pattern? If it is, great! I'll make it work. If there's something better, let me know!

Thank you!

* If there's a better grid view, I'm willing to try it!
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
It would be great if when I updated some collection
it might. i have only heard of one, may be it can help you.

just beware that informatix havent been seen in a while.
 
Upvote 0
Top