You are here

function nodejs_ajax_render in Node.js integration 8

Same name and namespace in other branches
  1. 7 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 23

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);
}