I am trying to use Socket.io in my Chrome extension, but for some reason I can't get it to work. The following is the code I have in my background.html:
<!doctype html>
<html>
<head>
<script src='socket.io.js'></script>
<script>
var socket = io.connect('http://localhost:8080/');
chrome.browserAction.onClicked.addListener(function(tab) {
socket.send('hi');
});
</script>
</head>
<body>
</body>
And my manifest.json I have the following for loading the background page and some permissions:
"permissions": [
"http://*/",
"http://*/*"
],
"background": {
"page": "background.html"
},
This does not work however. When the extension is loaded, it should connect to the Socket.io server, but it doesn't. I am unable to figure out what is causing this. This works perfectly when I simply run the background.html file. Any help is greatly appreciated!