Forum Discussion
MrFlo666
5 years agoExplorer
WebSocket doesn't open
Hello,
I am currently working on the development of an app under Unity 2019.3.8.f1. Device target is Oculus Quest 1 & 2 (focus on 1 for the moment). Script are developed in C# 4.0.
My problem is : to exchange data, I want to open a websocket. The code (see below) works if I launch my app under Unity, but doesn't when launched in my Quest.
public async Task<bool> Open()
{
Application.Model.DebugLogManager.WriteLogs("Attempt to open socket");
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;
}
{
Application.Model.DebugLogManager.WriteLogs("Attempt to open socket");
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 added some traces before and after the ws.ConnectAsync. The one before is well written ; the one after is not.
Moreover on my server side, I don't receive any query, so I guess that it is not sent or something.
I tested the following tricks to get more information:
- In Build Setting, "Internet Access" is set to Mandatory
- Checked the value of internetReachability that sends back ReachableViaLocalAreaNetwork (I read the documentation, I know it doesn't prove anything, but still)
- With Www class I tested to reach an external website, and it works.
So... who's my savior ?
Thanks
[EDIT] I just tested to call a REST API and same issue : the connection is never achieved. Good news or bad news : the origin of the issue might be the same.
1 Reply
- ed.montoya_Honored Guest
Hey did you end up figuring out how to solve the issue?
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
- 2 years agoAnonymous
- 1 year ago
- 4 years ago