my application, using socket.io, cant connect to node.js server.
server node.js
var app = require('http').createServer()
var io = require('socket.io')(app);
app.listen(1000);
io.on('connection', function (client) {
client.name = client.remoteAddress + ':' + client.remotePort;
console.log(client.name + ' connected!');
client.on('sensorChanged', function (data) {
console.log("HERE");
console.log(data);
});
});
android application:
SocketIO socket = new SocketIO();
try {
socket.connect("http://localhost:1000/", this);
txtView.setText("connected");
} catch (MalformedURLException e) {
e.printStackTrace();
}
socket.emit("sensorChanged", "argument1");
When i connect to the server, server doesnt say "socket.name connected", and doesnt emit event 'sensorChanged'. Where is the problem?