Socket IO flutter Connection error Android

74 Views Asked by At

I'm stuck dealing with a WebSocket issue in my Flutter app. Everything works smoothly on the web which is my PC (the server), but when I attempt it on my phone, I encounter a WebSocket connection error (timeout).

From what I've gathered, it seems to be connected to the address below:

(dart)
socket = IO.io('http://192.168.203.48:3000', <String, dynamic>{
  'autoConnect': false,
  'transports': ["websocket", "polling"],
  'timeout': 5000,
  'query': {'id': user_id}
});

So, I've experimented with different addresses like http://default-gateway-ip:port, http://pc-ip:port, and even http://10.0.2.2:port. Someone on Stack Overflow suggested using port 443, but unfortunately, that didn't do the trick either.

0

There are 0 best solutions below