Created
July 13, 2014 11:30
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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