Forum Discussion
MrFlo666
6 years agoExplorer
WebSocket not connecting
Hello,
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;
}
{
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;
}
{
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.
1 Reply
- JiapodoubeanHonored Guest
The solution I found and the bug mentioned in the posted below should have been addressed by OpenXR
https://forum.unity.com/threads/unity-doesnt-save-not-to-remove-internet-from-manifest.1472400/
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago