I have a 100 clients that connect to my server using websockets (now tcp). My code is very simple (see below). I have a client on T-Mobile 4G Data using a OnePlus 5t that is not able to connect to the server on mobile data, yet he can on wifi data. Any idea what could be the problem? I must note that I am using .netstandard 2.0 also.
What I have tried so far:
- User has checked that the app has permission to use mobile data.
- I have changed the protocol to use 'wss' instead of 'ws'.
- I have changed the port (user checked https://www.websocket.org/echo.html and it said he was able to connect to it).
- Finally, (a few weeks later) I have switched everything to a tcp client protocol and this still did not work.
None of these options have thus far worked.
public void Connect(string address, int port)
{
UriBuilder uriBuild = new UriBuilder("ws", address, port);
Uri uri = uriBuild.Uri;
_ws = new ClientWebSocket();
_tokenSource = new CancellationTokenSource();
ConnectToServerAsync(uri);
}
private async void ConnectToServerAsync(Uri uri)
{
await _ws.ConnectAsync(uri, _tokenSource.Token);
}