Wss connection works on WebGL builds but not on mobile or editor for some URLs

Open
#74 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp, unity
Domain
networking

Research direction

Start with Assets/WebSockets/WebSocket.cs at line 471 and reproduce the connection using wss://api.devnet.solana.com/ in the editor or a mobile build, comparing it with wss://devnet.genesysgo.net/. Use the provided stack trace and platform differences to determine the failure; done means the affected URL connects successfully outside WebGL without relying on BestHTTP.

Written by the indexing model from the issue text.

Description

Hey,
when i try to connect to this url, it works fine in the WebGL builds but not in editor or mobile builds:
wss://api.devnet.solana.com/

The error is:
Error! Unable to connect to the remote server

This URL works in Editor:
wss://devnet.genesysgo.net/

Any Ideas how I can solve the problem? Or in which direction I need to look?
When I use BestHTTP package it works, so I assume there should be some way this can be fixed in this package hopefully.

This is the Stacktrace:
at System.Net.WebSockets.WebSocketHandle.ParseAndValidateConnectResponseAsync (System.IO.Stream stream, System.Net.WebSockets.ClientWebSocketOptions options, System.String expectedSecWebSocketAccept, System.Threading.CancellationToken cancellationToken) [0x0010a] in <35e40e3005db46479c17ef7dd12bbfe4>:0
at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ClientWebSocketOptions options) [0x00383] in <35e40e3005db46479c17ef7dd12bbfe4>:0
at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x000d1] in <35e40e3005db46479c17ef7dd12bbfe4>:0
at NativeWebSocket.WebSocket.Connect () [0x001a5] in /Assets/WebSockets/WebSocket.cs:471

Dominant language
C#
Stars
1.7k
Forks
206
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from endel/NativeWebSocket

All issues in endel/NativeWebSocket

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.