Ionic Socket.io not working in iPhone


#1

Hi all,

I am using socket io client lib in my ionic2 app . If i run it on web, it works all right.

However if i install it into my iphone7 plus, it is not working: the code is quite simple:

import * as io from ‘socket.io-client’;

constructor(…){
this.url = "http://myserverurl"
this.socket = io(this.url);
}

sendMsg(msg){
console.log(this.socket.id);
console.log(this.socket.connected);
this.socket.emit(‘mymessage’, { from: “mobile”);
}

if i run this on the browser, when i send the message , i can see the socket id and the connected flag is true.

But when install it as an app into iphone7, the log says it is not connected.

i am using this lib:

“socket.io-client”: “^2.0.3”,

Can any one please help. very urgent. thanks.