-
-
Save mph-code/a125695a56960ba935c579d871ec5c41 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 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