title: chrome extension use the same socket.io connection under background page and content scripts
body: <p>I'm doing a chrome extension with socket.io , i have a content script that keep connecting to server to make a real-time chat, but i also want to get some information from server in background page. it works well separately like this</p>
  
  <p>in content script</p>
  
  <pre><code>var socket = io.connect('http://localhost:3700');
  socket.on('dosomething',function(){
    console.log("test");
  });
  </code></pre>
  
  <p>in background page</p>
  
  <pre><code>var socket = io.connect('http://localhost:3700');
  socket.on('dosomething',function(){
    console.log("test");
  });
  </code></pre>
  
  <p>but is there any way to only connect one time and when server have something like</p>
  
  <p>app.js  <code>socket.emit('dosomething');</code></p>
  
  <p>and will trigger either background page or content script which has   <code>socket.on('dosomething')</code>  ?</p>
  
  <p>I've tried sending the socket established by background page to content script by using
  <code>chrome.runtime.sendMessage</code>  and  <code>chrome.runtime.onMessage.addListener</code> , </p>
  
  <p>but it didn't work :(</p>
  
  <p>Is there any solution?</p>
  
  <p>Thanks a lot!</p>