endel / NativeWebSocket

🔌 WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP)
Other
1.28k stars 161 forks source link

Adds optional subprotocols to UPM version #30

Closed Bradshaw closed 3 years ago

Bradshaw commented 3 years ago

I'm working on a legacy project that requires the subprotocol to be explicitly declared. This is possible in both the browser's WebSocket class, as well as C#'s System.Net.WebSockets system. This pull request adds optional constructors that allow passing a string or a list of strings with subprotocols defined.

The browser implementation passes the subprotocols as the second argument to new WebSocket()
The System.Net.WebSockets implementation adds the protocols via the ClientWebSocket.Options.AddSubProtocol() method

This is the same as #29, but on the #upm branch