You are here

function nodejs_ajax_render in Node.js integration 7

Same name and namespace in other branches
  1. 8 nodejs_ajax/nodejs_ajax.module \nodejs_ajax_render()

Send some commands to the user asynchronously.

Parameters

array $commands :

array $options :

File

nodejs_ajax/nodejs_ajax.module, line 34

Code

function nodejs_ajax_render($commands = array(), $options = array()) {
  $options += array(
    'channel' => 'nodejs_user_',
    'uid' => NULL,
  );
  if (!is_null($options['uid'])) {
    $channel = $options['channel'] . $options['uid'];
  }
  $message = (object) array(
    'channel' => $channel,
    'commands' => $commands,
  );
  if (isset($options['callback'])) {
    $message->callback = $options['callback'];
  }
  return nodejs_send_message($message);
}