How to handle external database updates in react-native/redux? - react-native

I am creating a react-native mobile app for a service that has to interact with the service's API to get and update data.
This service also has a web interface through which users can sign in and use the service (aka getting and updating data.
Since I am only developing the mobile applications, I have no access to the code on the web side of things and my only way to make changes to that code is to go through someone else.
From the resources available online, I feel like I should be able to make a mobile app that interacts with and updates data through the API, however my thought process for how I am going to handle a user updating data through the web interface and reflecting that in the app has hit a standstill.
Does anyone know of a term that I can use to describe this in such a way that I will likely find more results online (or even better, a react-native npm package that achieves this functionality)?
So far I have tried searching the following, but have found few results:
redux caching
handling data updated on the server redux
redux how to handle data changing on the server
how to handle database updates redux

Sockets.io seems like it would work for realtime updates.
Essentially, it works by shifting the connection from a request-based HTTP deal (where the client asks the server for stuff) to a websocket in which the client and server can send each other things (like database changes :D) over a constantly open stream, even if after a delay.

Related

Can NUXT3 observe the values of server variables in real time?

I'm a developer who just started NUXT3.
Is the following scenario possible using NUXT3 and related modules?
An integer variable exists on the server.
The screen of the customer accessing the web page displays the current value of the variable.
Each customer can increase the value of that variable by 1 through the button.
At this point, the value should be automatically updated on the screen of all connected customers.
I know Vue.js and Websocket very well, so I've already implemented these programs using both.
But websocket is too cumbersome.
All customers must be managed in a clientList array.
Every time a variable changes, data must be sent to every time customers.
If the customer's phone's network is unstable and the connection is disconnected for a while, they should also handle the error during that time.
But nuxt 3 is a server-side rendering platform!
I feel like what I want is possible.
Or, even if it's not a web socket or socket.io, is there a good replacement for this real-time communication?
Once you have your SPA hydrated, there is no way to re-render on the server without nuking all of it with a hard refresh. So yeah, websockets are probably the best way but others solutions exist too: https://stackoverflow.com/a/74405860/8816585
Those tools are meant for that and work well so use them.

listener for changes in react native

Good evening everyone .
I am developing a react native app by interfacing to a database via endpoint (specifically aws).
Now on loading the dashboard I retrieve this data via API , save it in local storage and show it to the user.
Now from the management system, there could be some changes to this data that I show on the app, so what I was interested in knowing was if it was possible to create a sort of listener that calls my API whenever there are changes in the DB. I ask this because I would like to avoid calling the API every time a user lands on the dashboard and I would like to avoid calling the API every XXX minutes if there is no reason (if the data has not changed).
Is there any way to create an event listener? It would also be enough for me to be directed on what exactly to look for.
Thanks in advance for your availability

How to refresh vue.js application automatically as soon as sql table data has changed?

I want to show different kind of notes in my vue.js application to inform the user for example about an upcoming maintenance. I thought at an info "banner" under the application header. The data like period of the maintenance I would store in a sql database. In this database I want to regular when the banner should be visible or even not. Maybe with a table column called active.
Now I am looking for a solution how to trigger the vue.js application to refresh if data in database was added/updated.
Can someone help me please?
Are there any other ideas (maybe more professional ideas) how to trigger a note "banner" in a vue.js application?
The application will be hosted in Azure.
Thanks in advance!
Anatoly answer is right, those are your two options. You either make a request to your backend service every couple of minutes(depends how fast this info is changing) or you implement a web socket that will let your frontend now when the info has changed. It depends on how big is the app and what use you're going to give it, personally, in a scenario like this i would go with a web socket.
Here you have a nice library i've used in the past: https://www.npmjs.com/package/vue-socket.io . You will also need to make some implementation in your backend service to handle the info gathering.

Are there any registration/authentication api's which can be used in React Native

I'm developing an IoS and Android app using react-native, and am now starting to consider all the aspects of user registration, so that typically the person will provide some credentials, and then get sent an email (or possibly sms) enabling them to "verify" their account, after which point they are a registered user.
These registration processes (and subsequent emails/sms's seem to be fairly common , so I'm wondering if there are any API's which anyone has come across which make the job of creating the registration/activation process easier m rather than writing code from scratch ?
Many thanks in anticipation
It depends what you want when you ask for an API. If you're developing backend as well you can use Auth0.
If you want just to implement frontend, I guess you have to write your own code. Consider using something like redux or mobx to store your email and other things after logging in.
Anyways the REST part you have to write on your own. As for views you can google for it, for example there's react-native-login-screen

How to set up a server for my app

At the moment I am making an app. I am relatively new but have experience with a lot of different languages like PHP and SQL. My app needs to communicate with a server to post/retrieve data for everyone to see. People also need to be able to login and register. Right now I am using parse because it gives a lot of the requirements in an easy package but parse is retiring soon and I have no experience with setting up my own server.
I was thinking of making my own 'server' from an old computer but not use parse because it will no longer support push notification. Then of course the app needs to communicate with this server. I started looking online and found a lot of terms but not a real clear explanation on how to proceed. I need it to be able to communicate with iOS and Android. Furthermore I was wondering how to execute a script on the server itself. I want to do something with time, once someone uploads something it needs to disappear after 48 hours, but of course it also needs to do this even if the app isn't active on a smartphone
Can anyone tell me how I need to proceed, what to use and where i can find useful info.
My plan for now is creating my own server with something like MongoDB but then i still need something called a backend and different SDK's to communicate with the apps. Maybe its possible to install parse on my own server and add something so i can still use Push and run a script on the server itself.
All help would be very much App-reciated ;)!
The reason of a backend service or framework is to let developer focus on front end app development. Maybe you can check other options like firebase, meoter, or even leancloud. Don't be hurry jump to the decision to make your own backend.
Parse Server is already supporting Push Notifications. I think should keep using Parse. It will become the best framework for backend and API development in a short time. You can also use services like https://www.back4app.com that helps you in all process of configuration of your server.
Do you mean by create your own server running a personal derver pr you mean create your own back end application?