You are here

public function BackgroundProcess::sendMessage in Background Process 7.2

Same name and namespace in other branches
  1. 8 background_process.class.php \BackgroundProcess::sendMessage()
  2. 7 BackgroundProcess.class.php \BackgroundProcess::sendMessage()
6 calls to BackgroundProcess::sendMessage()
BackgroundProcess::claim in ./background_process.inc
Claim process. Before executing the callback, make sure no one else is doing it.
BackgroundProcess::dispatch in ./background_process.inc
Launch the process
BackgroundProcess::doKeepAlive in ./background_process.inc
Re-launch the process if necessary
BackgroundProcess::remove in ./background_process.inc
Remove the process from the DB (unlock).
BackgroundProcess::setProgress in ./background_process.inc
Set progress

... See full list

File

./background_process.inc, line 901
External API short overview

Class

BackgroundProcess
@file

Code

public function sendMessage($action) {
  if (module_exists('nodejs')) {

    // WATCH OUT FOR FUTURE DESTRUCTOR IN BackgroundProcess!!!
    $object = clone $this;
    $message = (object) array(
      'channel' => 'background_process',
      'data' => (object) array(
        'action' => $action,
        'background_process' => $object,
        'timestamp' => microtime(TRUE),
      ),
      'callback' => 'nodejsBackgroundProcess',
    );
    drupal_alter('background_process_message', $message);
    nodejs_send_content_channel_message($message);
  }
}