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 iOS without problem, but the socket.io isn't working, here is my javascript(the same way as the tutorial above):
app.initialize(); document.addEventListener('deviceready', function() { console.log(socket); socket.on('connect', function() { socket.on('text', function(text) { alert(text); }); }); });
and one more thing how can i get this console.log to debug?
here is how i'm getting socket.io(the same way as the tutorial above):
<script type="text/javascript" src="http://cdn.socket.io/socket.io-1.0.3.js"></script>
here is my server.js(the same way as the tutorial above):
var server = require('http').createServer();
var io = require('socket.io')(server);
io.sockets.on('connection', function (socket) {
console.log('socket connected');
socket.on('disconnect', function () {
console.log('socket disconnected');
});
socket.emit('text', 'wow. such event. very real time.');
});
server.listen(3000);
I think, that the problem and the tutorial didn't told is how i would connect my cordova app with port 3000