Chat Application on Ionic


#1

Hey ! I am developing a chat application which includes Group chat and one on one chat options. My concern is that can “Firebase” handle lets say i have 100 users ? I would like to use MySql but have no clue how to pull this of.
Thank You :slight_smile:


#2

What I do is use PHP/MySql on my server and set small web services to move data back and forth


#3

So you are saying it could be done using Php/MySql ? Could you atleast provide some screen shots of your application ?


#4

here is a snippet, to get you started
this little block of code will let you make password protected http calls

<?php
/**
 * User: benjohansen
 * email: benj@webspinr.com
 */

$token = null;
$headers = apache_request_headers();
if (!$headers) {
    $headers = http_get_request_headers();
}

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET,POST');
header( 'Access-Control-Allow-Headers: Authorization, Content-Type' );


$username = 'user';
$password = 'password';

if (!$_SERVER['PHP_AUTH_USER']) {
    $passfail = 'Fail';
} else {
    if ($_SERVER['PHP_AUTH_PW'] == $password && $_SERVER['PHP_AUTH_USER'] == $username) {
        $passfail = 'Pass';
    } else {
        $passfail = 'Fail';
    }
}

$ret = [
    'result' => 'OK',
    'Auth' => $passfail
];
print json_encode($ret);

LIke

        let fullURL = (https:://www.yourwebserver.com/path);

        let authHeader = 'Basic '+btoa(this.username+':'+this.password);

        let headersObj = new Headers();
        headersObj.append('Authorization', authHeader);

          this.http.get(fullURL,{headers:headersObj})

#5

Thanks its all what i need at this moment…