I am trying to read database continuously but I am not finding any way to do it.First of all I am having a doubt that wether Firebase Realtime Database can do this task with out calling api multiple times.As per I researched over internet to accomplish my task I came to know that socket.io package or web sockets can Abel to complete task but I am trying to find the difference between Firebase Realtime Database and socket.io package which is the best approach to read data in database continuously.If I use socket.io package then how should I connect to my server and what is the procedure can any one explain with example
Related
I am using rest apis for getting data but i want to update it in real time, I can't use firebase for the same. please suggest me any better way also calling api again and again is not good idea to achieve it.
For real time you need to use a real time database with a sdk for subscribe to it (like Firebase) or you can use socket.io to stream your data from a standard backend, socket.io is a library to abstract the WebSocket connections.
If you use node for backend i suggest you to read this topic on Nestjs https://docs.nestjs.com/websockets/gateways
I am trying to add the temporal feature in my application so that if there is an Internet, the data is sent in the application, and in the absence of the Internet, I keep it and then send it in the event that there is Internet. What should I do about this thing and what is the preferred library to use http or dio
i use dio_http_cache: plugin and it work with me but the best solutions is sqflite or hive
I am trying to decide between Firestore and MongoDB as the backend database, I have a doubt:
In Firebase:
Firestore has security rules built so this makes it possible for clients to query data directly from Firestore without cloud functions and still be able to read & write data that he is authorized to do so.
In MongoDb, the same logic of authorization to clients can be ensured with a server like Node.js or ktor application that acts as a mediator between the client and the database.
So my question is can clients query data directly from MongoDb and still ensure they read & write to data that they are authorized to without a server in between?
No, clients cannot query data directly from mongoDB securely. Even firestore cannot do this.
Firestore does have server in between the client and database. It's just provided and managed by Firebase so from our eyes it looks like there is no server. If you want to do something similar with mongoDB, you would pretty much build what firebase has build on your own.
Over the past couple of weeks I have been prototyping out some examples in symmetric DS. Looking for some guidance and examples because I am really running into some walls here. I have used the server and android examples successfully, don't need any assistance with setup on getting the basics working. It is a complex tool and I;m still learning it as well.
So I am trying to setup an environment where all the clients that run on android device sync up to a server. So I know it's fairly straight forward to do a setup where its 1 MASTER -> <- multiple clients, as the example that they provide do.
What I am trying to do is multiple masters to multiple clients. Essentially I want a database on the server for each client. Ill attach a diagram to try to help explain but I want a database for each store so store #1 has a master DB on the server and it syncs both ways with the client device.
server-diagram
SymmetricDS requires having a central node to store the configuration. I would recommend to have a central node with bunch of databases that connect to the central database. Connect each android application to another database. This topology will allow configuring what data syncs from the central node to the bunch of databases and what goes back
On the router from client to server you can set the target catalog to be a variable : $(sourceExternalId). This will use the clients external id as the database name on your server.
If you also need to replicate data back down you can set the external select on the triggers at the server. This would need to be an expression on your server database that would evaluate the current database. This would fire when a change occurs on the server database and populate the external_data column on sym_data during capture with the database that the change occurred in. You would then adjust the router from server to client to be a column match router type. Your expression then for the router would be: EXTERNAL_DATA=:EXTERNAL_ID. This would ensure that this data only be sent to the appropriate client.
My app reads data from two sources, a local sqlite file and a remote server which is a clone of the local db but with lots of pictures. I do not write to the server database, but I do need multiple simultaneous fetch operations.
What DBMS should I use for storing information on the server?
It needs to be very easily used from an iPhone app, be reliable, etc.
Talking to a remote server should not be tied to any platform like iOS. If you have control over the remote db server, the best bet IMO is crafting a RESTful API which you express your queries in, the server processes it and sends you the pictures/records using proper content type. If you do NOT have such control over the remote db, you'll have to stick to the API the db hoster provides. There are plenty such "on the cloud" db hosters (including NoSQL solutions) that give you a web-services interface to your db. MongoLabs is one such provider for MongoDB(which is a NOSQL db - meaning no schemas, no bounds on the structure of a "table"). You can continue to stick to SQLite on the client side.
You seem to have two sources of data local storage and a remote server.
This question on SO might help you to decide approaches of storing data on the server.
Once you have downloaded data using something like NSURLConnection class the images could be stored in the filesystem using writeToFile or the likes.
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag method.
You might like to save the rest of the data in sqlite. We used sqlite and the CoreData framework to save data for one of our applications and it worked fine for us. CoreData allowed us to interact with the database without actual SQL queries.
The iPhone client resides on the phone while on the server side we might have a database and a webservice interacting with the db. Webservice itself might be implemented in python or php like scripting language. The client interacts with the webservice that might return data in formats like XML or JSON. Thus there is no direct communication between the client and db. However, the client does implement network communication code to communicate with the webservice.
This page shows how to consume an XML based web service.