Skip to content

Instantly share code, notes, and snippets.

@aloncarmel
Created July 13, 2014 11:30
Show Gist options
  • Save aloncarmel/8ca2c9ee7a3215c7cedd to your computer and use it in GitHub Desktop.
Save aloncarmel/8ca2c9ee7a3215c7cedd to your computer and use it in GitHub Desktop.
Implement socket.io inside chrome extension or other internal JS files using jquery.
//Socket server connect to listen to data.
$.getScript('http://yoursocketioserver/socket.io/socket.io.js',function() {
socket = io.connect('http://lyoursocketioserver');
socket.on('connect', function(){
socket.on('message', function (data) {
//On data, do something with this...
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment