I can't find any documentation on what type of internal server PhoneGap is running on mobile devices, whether it's Apache, IIS, or some other minified web server. I'd like to know what type of server it is and whether it can be configured to allow external communication to a server, which is rejecting the incoming requests because it doesn't have the CORS support added to it.
We have 3 options
1) Add CORS support to allow AJAX from PhoneGap device to the web servers
2) Configure the PhoneGap web server to act as a proxy
3) Add a plugin, or write a plugin, which allows a native Android function call to allow communication to the web server
If you have any experience with these or advice on which way to go, your help would be much appreciated. Thanks in advance!
There is no internal server. PhoneGap/Cordova creates a base native application with the default view as a webview. A webview is a blank version of a web browser window. There is no web server component to PhoneGap.
Related
I have got a web application with the following topology.
A (Web application) ---calls---> B (Local Web Api) ---calls---> C (Remote Web Api)
I am trying to capture the traffic from B to C in chrome DEV tools - network tab, but nothing is logged. It only showing one server request. I want to see the subsequent calls made by that server request. Is it possible?
B is a web site hosted locally on my dev box in IIS.
You are currently only debugging your client side app, so DevTools will only show the single request to your local web API. In order to debug the middle layer, you need to debug the API.
If you are using Node JS for this, you can use the v8 inspector by running node --inspect and then use the debugging URL to open up DevTools. Alternatively you can fallback to using Node Inspector
If you are using .NET Web API, you can use the debugger in Visual Studio to see the subsequent calls to the remote API, but Fiddler is a very handy tool as well, especially for mocking.
I'm very noob on programming and using xdk. Do you how to use it?. I know you need to create rest web service for your laravel and then you call it using xdk, but how? do I need to have a web hosting service for this? Please help me. Thank you.
Intel XDK was the technology, similar to Cordova, used to develop cross platform applications. To develop native mobile apps you should look at Cordova or nativescript
To host any kind of application which is based on php backend, needs a web server like nginx, apache etc.
Yes you need a web hosting service.Put all your laravel code on server and interact with app using rest web service via XHR or Ajax Requests.
Is it possible to run an in-app HTTP server with NativeScript either as a background service or as part of the foreground app itself ? I am looking to utilize a common code base across a system of applications which would communicate to a local server which handles some parts of the application's communication to my servers. Where, I intend to create a HTTP server in the app which can just serve as a REST server for the app. Is it possible ?
Thank you.
I don't think its possible since nativescript doesn't offer any module or plugin that supports the creation of http servers. First option is to look for a nativescript module in npm that supports http server creation, Second option is to create an http server using the native API's with javascript, Third and last option (which I prefer) is to make your own server using nodejs or any server side script and run that server on a certain machine then from your nativescript app you can access that server using the fetch module or the http module :)
We have this architecture:
Web Server: Web Application is deployed (html, javascript, css)
Application Server: WebApi is deployed
Problem is , I cannot make ajax request to reach Application Server because its behind firewall.
The Web Application is supposed to be used publicly to the internet users.
What changes should we do to make it work?
Should we move our Web Application to Application Server? But how would this be accessible on internet.
Thanks in advance for suggestions/advice.
You're going to have to put an exception in the firewall for the address of your web server... that way your web server can access the API but nothing else can (well, not quite nothing else - other stuff on that web server can but that can easily be solved by having your web app hosted on it's own/dedicated web server).
If your Web Application makes direct calls to the Web API endpoint (e.g. is a single page application that use a client-side javascript framework like AngularJS and/or it uses AJAX calls to your application server address), there is no way for your clients to access your API if you do not allow public access to your application server.
That's because your client resides inside your users web browsers.
You have to allow incoming connections to your Application Server through internet in your firewall.
Well, it all depends on how you look at things and how distributed your application should be (criteria like load, security).
In general, Web API might be just one more client (from your applications server perspective).
On the other hand, in robust/distributed system, you would have Web API only as an endpoint (controllers, mappers and things like that) that your mobile/ajax clients send requests to and then Web API communicates to Application server (where your business logic is).
Having Web API communicate to DB directly is not a good idea because as you add clients to application server (mvc, web api, services, etc...) then you have as many db access points as you have clients. So, its a code maintenance problem plus a problem of your view tier being aware of DB.
Ideally, you need Application server as a tier where all your business logic is and its the one that all your clients target (mvc web app, web api, desktop, services, etc...) and that is the one that should communicate to your DAL. Also, then you can set firewall rules on your application server to allow incoming traffic from trusted sources (your other servers) instead from the whole internet (ajax).
How can I implement a mechanism for communication between a desktop application and a browser, for example Firefox or Google Chrome.
Is there a platform independent solution or I need to implement it for each platform separately?
The app either serve a webserver for the browser. or some other 3rd host would be the webserver, in which your application would communicate with the browser via-proxy (that is issue a request to the server 'Send the browser this data' ).
In addition, you would have to periodically check for updates from the server using AJAX or page refreshes due to the fact that the server cannot issue a command to the browser, only upon the browser request [This also possible through COMET or COMET-LIKE technology].