I am currently developing an application under Unity 2019.3.8.f1. Device target is Oculus Quest (1 for the moment, 2 then). .Net framework is 4.0.
In my application I need to open a websocket to my own server in order to send some data. Problem is : on one side, when I launch the application directly under Unity on my PC, the connection to the websocket succeeds ; when I do the same with the .apk installed on the question, the connection fails. However I have no reason why because my application doesn't crash, doesn't throw any exception, it just stays stuck when the websocket is called.
A part of the code I use is the following one :
public async Task<bool> Open() { await OpenWebSocket(); return true; }
private async Task<bool> OpenWebSocket() { ws = new ClientWebSocket(); Uri serverUri = new Uri("ws://X.Y.Z.W/mywebsocket"); await ws.ConnectAsync(serverUri, source.Token); return true; }
I tried the following tricks (with no success of course) :
- Set the Internet Access in Player Settings to Require
- Checked that internetReachability is well set to ReachableViaLocalAreaNetwork (even if this doesn't prove anything - I read the doc)
- Used the Www class to reach any website, and it works well
Of course, I test that on a secured and controlled wifi (my own one, actually), so there can be no issue on this side.
I lack of new ideas, so if all help will be appreciated.