chrome extension use the same socket.io connection under background page and content scripts
- 阅读更多 关于 chrome extension use the same socket.io connection under background page and content scripts
问题 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 in content script var socket = io.connect('http://localhost:3700'); socket.on('dosomething',function(){ console.log("test"); }); in background page var socket = io.connect('http://localhost:3700'); socket.on('dosomething',function(){ console.log("test"); }); but