It is necessary to transfer the message from the computer, there the client on NodeJS (at me). Recipient, Android client on javascript (cordova). I try to transfer using sockets.

NodeJS server code:

var io = require('socket.io').listen(8080); io.sockets.on('connection', function (socket) { socket.send("Test_Message"); }); 

Client code:

  var socket = io.connect('http://localhost:8080'); socket.on('connect', function() { socket.on('message', function(msg) { var di = document.getElementById("subscribe").innerHTML = msg + " "; }); }); 

When emulated in a browser (cordova run browser) - works. Emulation of the application on the computer and launch on the device do not give anything.

Maybe in the address you need to write not localhost?

  • Javascript on Android ?? Maybe Java on Android or just Javascript, anywhere? You will probably be advised to use TCP-IP. - AivanF.
  • Androida client on javascript, that's the whole problem) - Vasya Makarchuk
  • On the site or some language porting? - AivanF.
  • In the current form of your question can not give a concise answer. To get an answer, explain exactly what you see the problem, what technologies you use and what you want to see in the answer. - Grundy
  • Native Cordova application in javascript. You need to connect to the network to receive a response in the form of a message. - Vasya Makarchuk

1 answer 1

Solved. It is necessary to register on the device in the ip path of the gateway.