title: Connect quickblox chat server from node.js
body: <p>Please tell me the whether I have called the methods in is correct format or not        </p>
  
  <pre><code>var QB=require('quickblox');
  var QuickBlox = require('quickblox').QuickBlox;
  var QBChat = require('quickblox');
  var QB2 = new QuickBlox();
  var params, chatUser, chatService;
  params = {email: 'raji@gmail.com', password: ''};
  QB.init(21000,'NBRQfWA2OWwfBre','GNwMJzqPL8wZb8g');
  // QuickBlox session creation
  QB.createSession(params, function(err, result) {
  if (err) {
      console.log(err.detail);
  } else {
      console.log(result.user_id);
      console.log(params.password)
      chatUser = {
          id: result.user_id,
          pass: params.password
              };
      console.log(chatUser)
      connectChat(chatUser);
  }
  });
  function connectChat(chatUser) {
  chatService = new QB.chat({
      onConnectFailed: onConnectFailed,
      onConnectSuccess: onConnectSuccess,
      onConnectClosed: onConnectClosed,
      onChatMessage: onChatMessage
  });
  // connect to QB chat service
  console.log("connection")
  //connection = new Strophe.Connection(CHAT.bosh_server);
  chatService.connect(chatUser);
  }
  function onConnectFailed() {}
  // Connection is success
  function onConnectSuccess() {}
  // Connection is closed
  function onConnectClosed() {}
  var recipientID = 978816;
  var message = {
  body: 'Hello world',
  type: 'chat'
  };
  // send user message
  //chatService.sendMessage(recipientID, 'hello'); 
  // getting messages
  function onChatMessage(senderID, message) {}
  </code></pre>
  
  <p>I'm getting the following error</p>
  
  <pre><code>TypeError: object is not a function
  at connectChat (C:\Program Files\nodejs\chat1.js:33:16)
  at C:\Program Files\nodejs\chat1.js:28:3
  at C:\Program Files\nodejs\node_modules\quickblox\js\modules\qbAuth.js:52:27
  
  at Request.requestCallback [as _callback] (C:\Program Files\nodejs\node_modu
  les\quickblox\js\qbProxy.js:126:16)
  at Request.self.callback (C:\Program Files\nodejs\node_modules\request\reque
  st.js:373:22)
  at Request.EventEmitter.emit (events.js:98:17)
  at Request.&lt;anonymous&gt; (C:\Program Files\nodejs\node_modules\request\request
  .js:1318:14)
  at Request.EventEmitter.emit (events.js:117:20)
  at IncomingMessage.&lt;anonymous&gt; (C:\Program Files\nodejs\node_modules\request
  \request.js:1266:12)
  at IncomingMessage.EventEmitter.emit (events.js:117:20)
  </code></pre>
  
  <p>How to connect quickblox chat server from node.js. I'm trying to connect using chat plugin but can't even create chat instance. It shows the error </p>