You are here

function drupalchat_mobile_chat in DrupalChat 6.2

Same name and namespace in other branches
  1. 7.2 drupalchat.module \drupalchat_mobile_chat()
  2. 7 drupalchat.module \drupalchat_mobile_chat()
1 string reference to 'drupalchat_mobile_chat'
drupalchat_menu in ./drupalchat.module
Implementaiton of hook_menu()

File

./drupalchat.module, line 1214
Module code for DrupalChat.

Code

function drupalchat_mobile_chat() {
  $is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
  $data = array(
    'settings' => array(),
  );
  $data['settings']['authUrl'] = url('drupalchat/auth', array(
    'query' => array(
      't' => time(),
    ),
  ));
  $data['settings']['host'] = $is_https ? DRUPALCHAT_EXTERNAL_A_HOST : DRUPALCHAT_EXTERNAL_HOST;
  $data['settings']['port'] = $is_https ? DRUPALCHAT_EXTERNAL_A_PORT : DRUPALCHAT_EXTERNAL_PORT;
  $data = json_encode($data);
  $result = drupal_http_request(DRUPALCHAT_EXTERNAL_A_HOST . ':' . DRUPALCHAT_EXTERNAL_A_PORT . '/m/v1/app', array(
    'Content-Type' => 'application/json',
  ), 'POST', $data, 0, 15);
  print $result->data;
  exit;
}