jeudi 16 avril 2015

Cordova and Socket.io

I've got a Cordova app running on my android device. It has the following code:


var socket = io.connect('http://myipwhatever.com');



$('#logo').click(function() {
console.log('logo clicked');
socket.emit('athing', { somedata: "this data" });
}


On my server, I have this code:



io.on('connection', function(socket) {
console.log('connection');

io.sockets.emit('hello');

socket.on('athing', function(data) {
console.log('got a thing');
});
});


The client's code connects to the socket, but doesn't emit any events or receive any. The client is getting the button press event. Am I missing something here?


I should note, I'm not seeing any errors on either the client or server side.


Aucun commentaire:

Enregistrer un commentaire