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

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.

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.

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

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.

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?

Wufoo: update entry using API

Using Wufoo's API, is it possible (and if so how) to retrieve a single entry and update the information in it (without submitting it as another entry)? I can't seem to find any information on the Wufoo API website. If this isn't possible, any suggestions as to to work around this (such as using a local db). I'd like to build a hybrid app that authenticates locally and uses Wufoo for the data collection.
Thanks :)
I've been working on a similar kind of project and ran into the same issue. After submitting a help ticket, I was informed that the wufoo API does NOT support this function (update). Any updates would have to be done externally.
Like you, I would like to store my data in wufoo rather than externally, so I'm working on a few scripts that will serve as webhook endpoints for my wufoo forms. Whenever a form is submitted, one of these scripts will receive that data, do stuff with it, then use the API to relay the modified data back to a second wufoo form that "shadows" the original (same fields if needed, or new fields that reflect the processing I did).
This second set of forms would be the final destination for the data and only be accessed by my code. The first set of forms would only be accessed by live users. In a nutshell, it's a huge feedback loop that uses webhooks to trigger the processing.
Hope this helps.
for more info on webhooks, see http://help.wufoo.com/articles/en_US/SurveyMonkeyArticleType/Webhooks?q=webhook&fs=Search&pn=1
for more info on the wufoo api Entries api (get & post), see http://help.wufoo.com/articles/en_US/SurveyMonkeyArticleType/The-Entries-API

Android MySQL php+JSON alternative

I have written a simple database driven app in C# which uses a 2 table MySQL database. This is all a learning curve for me (except c#, which I am now comfortable with)
The app is small, has a couple of datagridviews, uses a few sql select/inserts statments to populate the datagridviews and also update records.
I want to port this app to Android. All of the internet sources I can find recommend a middle php sript which accepts http requests in order to fetch the data from MySQL and then return the results back to the android device where it is parsed with JSON etc etc.
This method is a little out of my reach since I dont have php experience, all of my attempts to implement the php layer have failed, speciially the android app was not receiving any data back, I'm assuming I messed up somewhere inside the php file.
Is there an easier (more noobproof) way to interact with the MySQL database from within android which doesnt require the need for php + JSON? Any ideas are appreciated, thank you in advance.
If you are comfortable with C#, why not use ASP.Net MVC for the middle man?
MVC is especially easy to deal with JSON, and you actually only need to create those "controllers" (as models should already be there from your existing app, and JSON don't need the View to display).
You can create a Web Service with C# that handles the data retrieval from the database; no need to go with PHP. Try create one with WCF API (check this question in order to create one). In order to create an Android client that consumes JSON on Android check this link.
If your mobile application have to access a database over the network you should indeed build a web service fronted to the database.
By putting a web access layer on top of the database you can expose the required queries in an abstracted, secure and convenient manner.
Though this sort of web service architecture can be implemented with PHP + JSON other technologies can be used as well. If you feel more comfortable with C# you can use it to build the web service instead. By doing so you may even be able to reuse some of the code from your existing application.
Actually, it would be better to take php in middle of android & mysql, due to the security concern and by the way this is the most easiest & comfortable method. here is link link. I hope you like it.