I\'m trying to use this simple tutorial:
http://socket.io/socket-io-with-apache-cordova/
My node.js is working fine and i\'m emulating to i
I made it, this tutorial is very good but it's not totally right.
You have to connect the socket to your server first (i'm using localhost and port 3000, but if you're using some server outside, i think you've to just put the ip and port):
var socket = io.connect('http://localhost:3000');
and after that, you call "socket.io", here is my complete code:
document.addEventListener('deviceready', function() {
var socket = io.connect('http://localhost:3000');
socket.on('connect', function() {
socket.on('text', function(text) {
alert(text);
});
});
});
<script src="http://localhost:3000/socket.io/socket.io.js"></script>
var socketHost = "http://localhost:3000";
var socket = io.connect(socketHost);