I think perhaps 'admin/reports/status' should include something for the detection of nodejs backend. When someone enables this module without the backend present, errors such as the following show in dblog:

Error sending content token "hQLZBRp9w8hqMzBV-Y7SGk54Ts3-sGB3BoQOXIqx5Vo" to the Node.js server: [-111] Connection refused

Perhaps, module should be disabled via its own code if the backend is not detected?

CommentFileSizeAuthor
#7 1546284-7-nodejs_requirements.patch1.25 KBadammalone

Comments

my3s of’s picture

Could you be more specific in how you fixed this "Node.js server: [-111] Connection refused" notice?

I'm having the same issue and would appreciate any explanation on how you fixed it...like when you say "nodejs backend" do you mean this module: Node.js Integration? As I have that module installed but i'm still having that problem.

Thanks in advance.

davorivas’s picture

I'm having the same exact issue... any light on this yet? Any help would be appreciated

revnoah’s picture

I am also having this problem. If any of you managed to resolve it, please post to this thread.

Anonymous’s picture

yes, this would be a great feature to add. patches welcome.

kiova’s picture

i have the same issue here.

polskikrol’s picture

Other modules show the existance of backend requirements via the admin status page. If the backend exists, the version is shown otherwise a warning that the backend is missing and should be installed. Thinking something like that would be beneficial in this instance.

adammalone’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

Here's a little something.

I've used hook_requirements to make a call to the nodejs server and report back the response.

adammalone’s picture

Title: Check nodejs status via admin/reports/status. » Check nodejs status via admin/reports/status [patch attached]
rli’s picture

Status: Needs review » Reviewed & tested by the community

Works for me, nice job.

Anonymous’s picture

Status: Reviewed & tested by the community » Fixed

thanks! committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jetsonj’s picture

I'm new to drupal and nodejs. Can anyone explain me how to use this patch I'm having the same issue

delta’s picture

I re-open this issue has the implementation can cause a fatal error depending of your install profile.

Here is the code I use, for not breaking the drupal install phase.

/**
 * Implements hook_requirements()
 */
function nodejs_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    $result = array();
    $requirements['nodejs'] = array(
      'title' => t('Node.js'),
      'description' => t('Can Drupal connect to the Node.js server?'),
    );

    // Initiate a call to the Nodejs server
    // and react to the response.
    $message = new StdClass;
    $response = Nodejs::sendMessage($message);

    // Nodejs::httpRequest() does the work for us. It will return FALSE if the
    // HTTP Request failed so we just check to see if that happened or not. If
    // There's a response, we can connect to the server.
    if ($response) {
      $result = array(
        'value' => t('The Node.js server was successfully reached.'),
        'severity' => REQUIREMENT_OK,
      );
    }
    // Http request to the server failed.
    else {
      $result = array(
        'value' => 'Error reaching the Node.js server. Enable HTTP error-logging and check the dblog page for more details',
        'severity' => REQUIREMENT_ERROR,
      );
    }

    // Merge the result from Nodejs
    $requirements['nodejs'] += $result;


  }
  return $requirements;
}

just return something, when the phase aren't 'runtime'.

check in the api, the hook requirements must return at least an empty array :
https://api.drupal.org/api/drupal/modules!system!system.api.php/function...

  • Commit ae08fdc on 7.x-1.x, 8.x-1.x, 8.x-1.x-head authored by typhonius, committed by beejeebus:
    #1546284: Check nodejs status via admin/reports/status