angularjs - Socket.IO with Cordova not working on Device -


i'm developing apache cordova app ionic framework should communicate through websocket , use socket.io library it. when run on desktop browser works fine when build android , test on smartphone doesn't work.

my server looks this:

var app = require('express')(); var server = require('http').server(app); var io = require('socket.io')(server);  server.listen(8200, '192.168.0.127', function() {   console.log('server listening...'); });  io.listen(server);  io.on('connection', function(socket) {   socket.emit('init', data); }); 

and since ionic friends angularjs client controller looks this:

.controller('appctrl', function($rootscope, $scope, serverurl) {    var socket = io.connect(serverurl.serverurl()); // serverurl: 'http://192.168.0.127:8200'    socket.on('init', function(data) {     //   }); 

i included socket.io client script in index.html head this:

<script src="lib/socket.io/socket.io.min.js"></script> 

when remote debug app throws repeatedly different t parameters:

failed load resource: net::err_address_unreachable     http://192.168.0.127:8200/socket.io/?eio=3&transport=polling&t=1431079993172-0 

i've thoroughly searched every related question on here didn't solve problem. need thing work , appreciate help.

thanks in advance.

it ip address issue. 192.168.0.127 wifi ip of desktop somehow everytime connected smartphone desktop deploy app lan network build , wifi adapter disconnected 192.168.0.127:8200 out of reach. deactivated lan network in windows control panel , works fine.


Comments