How to make an end to end app connection with ionic? - ionic-framework

Is there any possibel way to connecting two or more ionic apps to each other? for example realtime or true time negotiation, sendind text, medais or information (directly and end to end)sharing?

Related

Flutter: what is the best practice for auto & periodic update of a flutter element

I'm trying to build a flutter app
which shows a chart that reads data from a MySql database (a table)
I want to update the chart
when the data in the table is updated
without manually refresh the page
the table is updated by a script run by a cronjob (hourly, for example)
the first way that comes to my mind is
using flutter's Timer.periodic function
so that the app can periodically check the table if there is any update
but, in this way, I can not get a real-time update (to do so is seriously expensive)
So the second way I could think of is
using WebSocket
however, I'm sure if it's possible or an appropriate way to do this.
because I don't know how to do that.
should the app (flutter) websocket commnunicate with Mysql?
should I implement backend websocket to let flutter know the update?
Using WebSocket is the best way to implement real-time update chart application?
Or are there any other ways that can solve this issue?
Thank you for whoever answer to this question.
You can use the websocket to let the application know about the new updates. For example, if x device inserts a new record you can send it to the websocket and listen for it from the y device. During this process, you can insert that data to the database from the server side and you don't need to fetch data again and again to achieve real-time.(you have to build logic to listen and update the UI as your needs) Rather than MYSQL, it would be more efficient if you use the mongodb with nodejs API for this. There are a lot of tutorials about websocket implementation with flutter.
Also you can use firebase for real-time communication. You don't need to worry about the server side if you use the firebase. Keep in mind to follow recommended guidelines from the documentation since they count the bill for each request you send from your application.
Another option is Appwrite. As I heard, it is the best replacement for the firebase and since I haven't used it yet I'm not going to say more about it, but you should try it if it is a match for your requirements.

Emit data to all clients on a Google Web App

I have a Google Apps Script bound to a Google Sheet, and have published that as a Web App. It is restricted to a certain Google Workspace. That Google Sheet is kind of an improvised database for that web app and changes over time. I would like to send the updated data to all clients once the Google sheet gets changed. Is that possible? I don't need a trigger for the edit, since I know in the script when I add new data, so this is the time to send the new data.
Basically the same question can be formulated as follows: We know that we can execute a server-side function from the client with google.script.run, but is it also possible to execute a client-side function from the server i.e. the apps script?
My current workaround is a client-side setInterval which checks for server-side updates (and fetches them using successHandler) every 30 seconds or so. It works, but is not optimal.
Just to mark this one as answered. Cooper writes in the comments:
"It's not possible to execute a client side function from the server unless it has been first initiated by the client and it's responding with a callback. Polling is your only option I think."

iPhone / Android realtime communication, XMPP, raw TCP?

I have an app that has 2 versions : 1 on iPhone, 1 on Android.
I want my 2 apps to communicate in real time. The use cases are :
User A sees a friends list, pick a user B and click on "share an item"
User B get a notification saying that user A wans to share an item with him
User B accepts, the transaction takes place, and both users are notified that it goes well.
I thought about using a simple HTTP transaction, but that would polling for the user therefore not a nice user experience.
I think XMPP would fit nicely, but I'm not quite sure how flexible this solution can be ( what if I want to keep my users information on a separate server also etc. ). I also consider using a raw TCP socket ( Node.js on the server is fairly easy to operate ).
What's the best solution at the moment ?
Well, your requirements are pretty much:
Real time
Friend list
Presence
Sharing of data
These are all features of XMPP, and there are library implementation available in multiple languages. Smack for Java and xmppframework for Objective C will cover your particular use case.
You could of course write this yourself from the socket layer up, but why bother when there are existing standardized protocols and libraries available to do what you need. This way when you want to add Blackberry or any other platform to your list, I am sure
you can easily find the right library to support your app without having to build from the ground up.

How to check for server side update in iPhone application Web service request

I have kind of Listing application for iPhone application, which always calling a web service to my php server and fetching the data and displaying it onto iPhone screen.
Now, the thing to consider in this scenario is, my iPhone application everytime requesting on the server and fetching the data.
But now my requirement is like I want to replace following set of actions with above one :
-> Everytime when my application is launched in iPhone, it should check
for the new data at the server`.
-> And if server replies "true" then only my iPhone application will made a
request to fetch the data.
-> In case of "false", my iPhone application will display the data
which is already cached in local phone
memory.
Now to implement this scenario at server side (which has php, mysql), I am planning with the following solution :
Table : tblNewerData
id newDataFlag
== ============
1 true
Trigger : tgrUpdateNewData
Above trigger will update the tblNewerData -> newDataFlag field on Insert case of my main table.
And every time my iPhone app will request for tblNewerData->newDataFlag field, and if it found true then only it will create new request, and if it founds false then the cached version of data will be displayed.
So, I want to know that, is it the correct way to do so ? or else any other smart option available ?
Thanks in advance.
You should consider making the field a counter instead. Every time any change is made to your database, the counter is increased.
Now when the iPhone connects, it will compare that current counter with the counter from the previous fetch. If the counter has changed, it will fetch updated data.

Manage country wise databases on different servers in iPhone App

I have current a developed app which I am going to submit in just few days .
Currently The Application shows data by calling a web service and fetches data from a server .
Now client requirement is to build two different databases.
So the question is should I make two different builds for two different countries or should I make alternative call to the web services based on the format region selected in the iPhone .
e.g, if ( country == uk ) then
call uk_Service;
else if( country == us ) then
call us_Service;
Please tell me which approach is better. And also if should I make two different builds then can I submit both of them at a time in the AppStore .
Thanks
I don't think it is a good idea to have two different builds for the App Store. This would mean that you have to do all the organisatorial overhead in iTunes Connect twice. For example an update with all the screen shots and textual descriptions have to be submitted twice. Also you do not have a chance to ensure the release of both submissions will be synchronous.
Why don't you provide a setting to the user where he can choose the country he wants to use your app for?
I would go with the if/else option purely because maintaining 2 apps instead of one will be more work - eg when you want to fix a bug you'll have to do it twice over. Another advantage of using the localised version is that a user can change their localisation and start using the correct database - eg they buy the app in the US and then move to the UK, change their settings and can start using the UK database without a problem