You are here

function nodejs_add_channel in Node.js integration 8

Add a channel to the Node.js server.

Parameters

channel:

Return value

boolean

File

./nodejs.module, line 364

Code

function nodejs_add_channel($channel) {

  // Http request went ok. Process Node.js server response.
  if ($node_response = nodejs_get_nodejs()
    ->addChannel($channel)) {
    if ($node_response->status == 'success') {
      return TRUE;
    }
    else {
      \Drupal::logger('nodejs')
        ->error(t('Error adding channel to the Node.js server. Server response: %error', array(
        '%error' => $node_response->error,
      )));
      return FALSE;
    }
  }
  else {
    return FALSE;
  }
}