Reduce costs in the firebase component

I know what real time is. Yes, of course, each Update, Delete, Create update will be updated on the app, website and desktop within your company. How to do this ? For every SQL command that changes the table, everyone who accesses that table will be updated instantly.

Yes, so how do I that? By downloading data from mysql every few seconds using kodular blocks, then check whether anything has changed? Or is there a better more elegant, less resource intensive method?

You do not download data from mysql. You work with POST methods. If you want a data search, do a Select. If you want to include data in the bank, use Insert Into. If you want to update something, use Update.

If another device updates the data in mysql (say, adding a new chat message), how does my device know that the data in mysql has been updated with the new chat message? How do I “listen” to a data change?
I am sorry if I sound stupid, I really know nothing about mysql.

This involves designing the bank to link messages to a room or chat. And it involves your app’s algorithm.

I can’t guarantee that it works, but I can suggest this:

You could rethink and recreate your application back-end using Laravel, expose an API, use Laravel Broadcasting, and the WebSocket Client extension


References:

https://laravel.com/docs/7.x/broadcasting

In many modern web applications, WebSockets are used to implement realtime, live-updating user interfaces. When some data is updated on the server, a message is typically sent over a WebSocket connection to be handled by the client. This provides a more robust, efficient alternative to continually polling your application for changes.


It’s just an idea

1 Like

I think using the web component you will post text to the server hosted script which will get the latest data from your db and you can filter the records based on what data should be pulled.

Like in case of chat, if A person is talking with B&C&D then you just pull data which involves only A and B or C or D as applicable.

You need to put that in a timer block to keep checking repeatedly.

2 Likes

Exactly. It involves the design of the bank and the logic of the app. The bank update is immediate. In the app, it will make a logic to be shown that last message from that chat room where the A & B & C & D people are …

1 Like

https://medium.baqend.com/real-time-databases-explained-why-meteor-rethinkdb-parse-and-firebase-dont-scale-822ff87d2f87

I got answer this regarding realtime database.

1 Like

Wow. Sounds good. But thing is, I don’t mind complicated but if I can’t find tutorials on how to use websockets and node.js and have them work with kodular or app inventor, I really am clueless on how I can do them.

There are tutorials out there on how I can connect mysql with kodular, and how to make them communicate, but I have not successfully found tutorials on how to connect mysql to node.js and websocket. To be honest, I am just regurgitating what I read without understanding much what websocket and node.js do to make mysql realtime and whether we need both or just 1 of them.

If you know any good tutorials on how to make them all work together with the app inventor franchise, I will get down to it immediately.

So “Post text” is inside the “timer” inside kodular to keep checking for new data every few seconds?
How do I check whether there is new data? Is there a script to check whether there are new data before I download the table? Or do I have to download the table, then do the checking inside kodular to see whether there are new data?

1 Like

I am also waiting :thinking:

Okay first tell what kind of application your are building and what piece of data your users will be changing that needs to be shown to all other users. Then we can better say what piece of data needs to be pulled from the Database whenever there is any change, while other data which your users don’t care about can be static i.e. stored one time.

1 Like