I am using Angular to build a Hybrid Mobile app using Phonegap with the front end of ionic.
The issue is that at the launch of my app I see multiple http requests emerging from my App with respect to DSP. I don’t have a problem with that; may be that is the part of your DSP framework.
But my issue is that out of the many calls which happen by the framework some of them take a long time to complete. For example the call to System API takes almost 15-16 seconds.
Even that would not have been a problem for me as that is happening in the background, but the problem is that my REST API calls fail if I make them before these background calls end.
Some of the calls, I see happening in the background of Chrome Developer tool are as below:-
http://ec2-***********-23.ap-southeast-1.compute.amazonaws.com/rest/api_docs/system
http://ec2-**********-23.ap-southeast-1.compute.amazonaws.com/rest/api_docs/db
So, here are my questions:-
Why does DSP make calls to all these APIs even if I am not using them all. Please note that the only API I intend to use is my Remote SQL DB service, which also is one of the calls, but that is Ok, as that is the API I need.
It is also waste of bandwidth and time for my app to be able to make calls.
If there is no way that I can avoid this, and I have to wait for these calls to complete, in that case, can you please tell me if there is any way in Angular that I can know when these calls are all over, and now the framework is ready for firing API calls.
This is one of the calls, which fails DreamFactory.api.sql.getRecords(request); if made before the above calls complete. ‘sql’ is the name of my Remote SQL SB Service.
Since, I already know I dont need any of the APIs apart from my own Remote DB SQL service, is there a hack or something, where I can comment something off, and these unwanted calls don’t happen in the backend, and my app works normal, or has a short starting up delay as compared to 16-17 seconds now. I consider it huge as the User has to be forced to wait for this period.
Additional Info: I am enabling CORs and Guest User, which has only access to this sql service, and no other services or Apps.
This SDK injects Swagger-JS into angular as a service. The feature for only grabbing the API(s) you need was added to their latest release and I believe uses the new 2.0 Spec. Let me check on that, also sure, there is a for each in their for the apis, you could just remove that and get the one you want. I’ll take a look.
All the calls to rest/api_docs are needed in the init phase because the API need to know and prepare all the methods for your call (in your case .sql. ; But, db and system are called because there exist in DSP).
Now. We can not make a call to our methods until they are ready and loaded.
¿How we know they are ready?
The API make a $rootScope.$broadcast(‘api:ready’);
Then, you can use $Scope.$on and make your calls after that.
¿Why we use the version 1.0 of the API?
We do not use the last version of the API because the last version do not have report with console.log. We think it is very important to report to the console all the possibles errors and the documentation too. (The version 1 have a console.log(‘api:ready’) when it is loaded and very important information about the calls.)
For more information about $emit, $broadcast and $on please refer to:
I am not clear what I am supposed to do with this console print I got.
Just to re-iterate my issue, my app takes a long long time to load, sometime even 30 seconds of load time. And if I see the network calls, I see DSP is fetching all these api_docs etc at the time of launch before it fires api:ready.
This is a wasteful call for me, and that is why I was wanting to determine if I can tweak this in some manner.
30 seconds of launch time seems too huge to the customer. Testing in 3G.
But nothing opens on this link, and can you also give me some example on what exactly needs to be done in order to send build options?
Where and how?
I would want the api_docs call to fetch only those services which I am interested in and not all of them, as it does now and results in many seconds before api ready is fired.
Let us know what feedback you have. This is all open source, so feel free to make pull requests or post issues, bugs, features on this forum. We’re going to improve the Angular SDK next quarter and start working on Angular 2.0 integration as well.