You are here

function nodejs_logout_user in Node.js integration 8

Same name and namespace in other branches
  1. 6 nodejs.module \nodejs_logout_user()
  2. 7 nodejs.module \nodejs_logout_user()

Logout any sockets associated with the given token from the node.js server.

Parameters

mixed $token:

Return value

boolean TRUE if the user was logged out, FALSE otherwise.

1 call to nodejs_logout_user()
nodejs_user_logout in ./nodejs.module
Implements hook_user_logout().

File

./nodejs.module, line 130

Code

function nodejs_logout_user($token) {

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