You are here

function drupalchat_mobile_chat in DrupalChat 7.2

Same name and namespace in other branches
  1. 6.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
Implements hook_menu().

File

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

Code

function drupalchat_mobile_chat() {
  global $is_https;
  $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);
  $options = array(
    'method' => 'POST',
    'data' => $data,
    'timeout' => 15,
    'headers' => array(
      'Content-Type' => 'application/json',
    ),
  );
  $result = drupal_http_request(DRUPALCHAT_EXTERNAL_A_HOST . ':' . DRUPALCHAT_EXTERNAL_A_PORT . '/m/v1/app', $options);
  print $result->data;
  exit;
}