You are here

public static function Nodejs::sendMessage in Node.js integration 7

Same name and namespace in other branches
  1. 6 nodejs.module \Nodejs::sendMessage()
2 calls to Nodejs::sendMessage()
Nodejs::sendMessages in ./nodejs.module
nodejs_send_message in ./nodejs.module
Send a message immediately.

File

./nodejs.module, line 870

Class

Nodejs

Code

public static function sendMessage(StdClass $message) {
  self::initConfig();
  drupal_alter('nodejs_message', $message);
  $message->clientSocketId = nodejs_get_client_socket_id();
  $options = array(
    'method' => 'POST',
    'data' => drupal_json_encode($message),
    // This is server to server, so start with a low default timeout.
    'timeout' => !empty(self::$config['timeout']) ? self::$config['timeout'] : 5,
  );
  return self::httpRequest('nodejs/publish', $options);
}