I recently started to do development in the Haxe language with OpenFL (AS3 background).
But I have never worked on an app that communicates with a server - or never done any programming for servers for that matter!
I have to make a mobile app (for which I intend to use Haxe) where the new user creates an account on the server, and thus also interact withe other user accounts in a desired way.
So could someone guide me in the right direction to approach this situation? I'm guessing I will need to use PHP or ruby etc.
or can I use Haxe to program on the server? are there any good libraries that also provide security while making facility for user accounts? Is AWS or Google app engine something I can use?
check this simple but complete tutorial by filtreck
http://mromecki.fr/blog/post/haxite-writing-entire-website-using-haxe
You will want to create normal web pages that you can host on the server which will retrieve the needed information.
After having uploaded these, use a type of webview in the application to load the pages and retrieve this information.
You can write your server in Haxe if you want, and if you use a platform that supports it you could use TCP and haxe.remoting to pass data between the client and the server.
haxe.remoting is intended to make calling haxe function in a server from a client easier so that may be what you want.
If you don't feel confortable with using TCP you could do as Max wrote, just make some HTTP API (you can do this too in haxe) and do normal HTTP request from the client.
Related
I want to code an Android client and a Windows.exe server application (possibly PHP., I am still trying to decide).
I have no problem with developing the server app, but have not yet done any Android coding. Mostly, though, I am unsure about how to communicate between client and server.
A client aapp will login to the server then at regular intervals send its location (GPS coords) to the server which will store the data in a MySql database,
A second Android app will display a historical trail of where the first user has been using Google maps, plus a little more functionality.
Since I am not serving HTML, I am wondering whether to use HTTP GET / POST or a proprietary protocol over TCP/IP. I would like to encrypt it, so SSL seems in order,
Is there any compelling reason to use one or the other of use HTTP GET / POST or a proprietary protocol over TCP/IP?
Would coding my Android app be easier if I used JSON as my data format (or something else?), irrespective of the protocl used to transfer the data?
Hmmm, since much of the data returned as a response to GET by one of the apps will be data used to draw a Google map with a series of points showing travel, could I do the heavy duty processing on the server & return the HTML (or JS) necessary to display it an dhave the app embedd a browser in its UI to display the map? (the UI will also disply more, but maybe I shoudl just make it browser based HTML & JS, rather thn an actual Jav Android app? As you can see, I am confused)
[Update] I want to code both the clients and the server and to host the MySql database. I would prefer no 3rd party frameworks unless they are excedding simply to use and play very well together with Delphi or PHP.
I may recommend you to use Wcf with poco entity that provide you security as you want and create client in android to consume it.here is simple example of using wcf in android-http://fszlin.dymetis.com/post/2010/05/10/Comsuming-WCF-Services-With-Android.aspx
I would strongly recommend the use of the newest Google Play Services with the Google Cloud Messaging... It takes out of you all that work.
Check out, see if you like ;D
Google Cloud Message: http://developer.android.com/google/gcm/index.html
There is also a great video of this year's Google I/O about the maps improvement on Google Play Services:
https://developers.google.com/events/io/sessions/325172829
Are you trying to create App that can be delivered from Google Play Store or a Andriod enable Web application? You Question is confusing in your need. If you are looking to create Andriod Apps then definitely PHP is not going to serve it up. Look for Andriod SDK and create your interface using that, then for Windows Server EXE you can do PHP based API or as suggested by other answers. But for User interface PHP is no. You need to read and understand the different between APP and Web App. or your question is not very clear on topic.
I plan to use asmack lib for a chatroom app on android, however, I just want to use PHP as server scripts with mysql as backend database server. I hope I can find a way to build it without openfire, is it possible? Any suggestions to implement them?
You can use whatever server you want. asmack is a client library that communicates via XMPP, which is language agnostic. Select any server you would like and your client should work fine.
Your comments about whether OpenFire has a PHP api though are somewhat confusing, do you want an OpenFire server or not? The language the server is written in is irrelevant to your client app.
What is the best way to connect an android application and a php server using sockets? I am trying to implement a chat system between multiple clients, but I know that PHP does not allow multithreads.
Sorry for not giving enough information about what I intend to do. I basically want to create an app simmilar to google latitude, and I also want to implement a chat system between the users. I have aldready decided that I am going to use a MySQl DB and therfore a PHP server so the client communicates with the DB using JSON for data exchange. I am quite new to this and I don't know how the architecture Client-Server-Client communication should look like. I found out that the easiest way to do this is using HTTP requests, but I don't know how I should implement this.
I think you can use jabber protocol, install any xmpp server and you can connect to that from android, this is standard for chat applications
use xml-rpc base php webservices for chat server. your chat client will contact to chat server throught web services.
*I was going to make this a comment but I ran out of space, plus it does have some answer-y qualities to it.
This question does not contain nearly enough information for anyone to usefully help you. How do you think it should be done? You can't ask people to critique an idea when you haven't told them what your idea is.
PHP is the wrong language for this, because (as you rightly point out) it can't be multi-threaded - amongst a multitude of other reasons. I personally would recommend Node.js (or possibly Java), but that's just my preference.
If you still insist on using PHP, take a look at this. It might give you a point in the right direction for a non-blocking multi-IO setup such as this - but you're letting yourself into a whole world of unnecessary complication by doing this in PHP.
here is my scenario, i am building a web application using PHP and MySQL. basically it is a real estate application. where i would like to share the data among several other platforms and devices, here is i what i intend to do
a) building the web app to be used with the browser using PHP, MySQL, and AJAX. (this will be my server)
b) extend the support and build a desktop application using POKKI.
c) extend the support and build an application for Androids and iOS devices.
d) all data transaction for the app should take place from the web server.
e) basically it will be server client application . where the server will be my web server and the clients will be iOS app, Android App Pokki etc.
i am not a hardcore programmer, although it has been more then 1 year since i started using PHP, and i do understand it to my use. i would like to know the best feasible solution on how to share the data among the different clients(POKKI, iOS App, Android App).
i would like to know.
a) do i have to connect to database directly from the client and access the data? is it possible? is it bad if i go this way?
b) do i have to create a public class with api sign up process? what would be the real scenario if i would like it to make it cross platform.
A Humble request to all of you to guide me on how does this things works. any articles, resources, links that can prove useful to me will also be appreciated.
thank you.
I think you should create an API which allows you to access the database strictly as you want it. Look at the twitter API for example and see how it allows third parties to access their data using simple requests.
So your site uses the DB directly where as all other applications you want to make will use the API ( which runs on ur web server)
This would allow you with the flexibility to have control who gets access and who doesnt ( only your own apps or even third parties etc etc) and allows you to build kick-ass applications without putting your actual database at risk.
Hope this helps!
1 - you should not allow client to access data directly - bad.
2 - sign up are easy with open id, let google or any other openid provider handle authentication, you deal with your own clean code without worrying about auth.
http://code.google.com/apis/accounts/docs/OpenID.html
You can create xml api and share the data from your server.
On different type of client you can eaisly parse the xml data and process it or show it.
In xml API if you want the restrict access then your can provide the restriction.
Please let me know if you have any issue
Thanks and Regards,
Ankur K Singh
take a look into getfrapi.com for building API.
I'm creating a website using PHP and MySQL, and I'm trying to add some Silverlight stuff to the site. I need the users to be able to do stuff in the Silverlight app, and for that data to be saved in the MySQL database. I'm wondering about how I could do this...
Can I get the client side Silverlight app to log in to the server side MySQL database? Would this be a security risk? And if it's possible, how would I do it?
Or is there a better way anyone can think of? And any ideas how I'd implement it?
Thanks everyone! :)
No you should not have the app interact with your MySQL database directly. In this type of situation you will need to implement some form of web service, which exposes your data to the client. The Silverlight client code will then send requests to the web service, which runs on the server and has access to the database. Using a Microsoft technology on the server will make this a lot easier, because the IDE will do a lot of the wiring up for you, but I'm sure it could be done with PHP as well.
I would look into how to create a PHP, REST or SOAP based webservice and go from there.
Here is a video explaining how to consume the service, once you have that sorted out on the server.
http://silverlight.net/learn/videos/silverlight-videos/http-communication/