Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do popular Android apps connect to a server? [closed]

I usually connect to a remote MySQL database from an android device using a PHP script to manage the database, run this script using the HTTP protocol and code data in JSON format. I am now looking for a more professional method that can handle thousands of connections and is secure at the same time. Will hashing be enough to make it secure?

How do popular apps connect to servers and how do they handle authentication, security and lots of traffic?

like image 920
DigiDude Avatar asked Oct 31 '22 08:10

DigiDude


2 Answers

NodeJs is very good to create a server to your apps, it does connect with mysql really easy:

    var connection = mysql.createConnection(
    {
      host     : db_host,
      user     : db_user,
      password : db_password,
      database : db_database
    }
);
connection.connect();

and handles websocket connection, which makes the communication with your apps and the server fast enought to make real time stuff.

Here's a link to a simple nodejs server and the android app, just connect the server to the DB and your done!

like image 58
Moisés Avatar answered Nov 12 '22 13:11

Moisés


Popular apps that connect to servers do so by:

  1. either using a web service
  2. connect to database (MySql in your case) using a server language (like PHP)

The number of connections that the app can handle depends a lot more on the server. That is hardware, software, scaling techniques like caching, load balancing, etc...

As far as security is concerned, hashing does help and connecting to the server through https does not hurt either.

like image 35
Ola Avatar answered Nov 12 '22 12:11

Ola