You are here

function nodejs_logout_user in Node.js integration 7

Same name and namespace in other branches
  1. 8 nodejs.module \nodejs_logout_user()
  2. 6 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 129

Code

function nodejs_logout_user($token) {

  // Http request went ok. Process Node.js server response.
  if ($node_response = Nodejs::logoutUser($token)) {
    if ($node_response->status == 'success') {
      return TRUE;
    }
    else {
      watchdog('nodejs', '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;
  }
}