title: Chrome Extension Socket io node js
body: <p>I need to create a chrome extension which shows a notification when we get a message from socket io node js server. </p>
  
  <p>How to include socket io in chrome extension? I am not able to get this to working.</p>
  
  <p>Content.js:- <strong>Uncaught ReferenceError: io is not defined</strong></p>
  
  <pre><code>var socket = io.connect('http://localhost:1337');
  socket.on("hello",function(data){
      console.log(data.text);
      chrome.runtime.sendMessage({msg:"socket",text:data.text},function(response){});
  });
  </code></pre>
  
  <p><strong>Manifest:- This is not importing socket io</strong>
  Failed to load extension from: 
  Could not load background script '<a href="http://localhost:1337/socket.io/socket.io.js" rel="noreferrer">http://localhost:1337/socket.io/socket.io.js</a>'.</p>
  
  <pre><code>    "background": {
      "scripts": [
          "http://localhost:1337/socket.io/socket.io.js",
          "background.js"
      ]
  },
  </code></pre>
  
  <p>node server.js</p>
  
  <pre><code>var app = require('http').createServer(handler).listen(1337);
  var io = require('socket.io').listen(app);
  
  function handler(req,res){
      console.log(req.url);
      res.writeHead(200, {'Content-Type':'text/plain'});
      res.end('Hello Node\n You are really really awesome!');
  }
  
  io.sockets.on('connection',function(socket){
      socket.emit('hello',{text:"node!"});
  });
  </code></pre>