[browser][wasm] Wasm websockets support (#37962)
* [browser][wasm] Initial addition of WebSockets support
* Clean up usings
* Create and use a WebSocketHandle.Browser.cs module
* Add conditional TARGETS_BROWSER so as not to throw Proxy PNSE during ClientWebSocket creation.
* Update WebSockets code
* Removing debug line
* Remove `ThrowIfReadOnly` method to address review comments
* Address review comments
- change accessor of _requestedSubProtocols to private
- condition more code in WebSocketHandle.Managed.cs to not access _requestedSubProtocols
* Address review comments
* Address review comments
* Change to be PlatformNotSupportedException
* Add ConnectAsync implementation to create a new instance of the BrowserWebSocket implementation.
* Address review comments
* Address subprotocols comments
* Remove internal custom class ActionQueue class in favor of using a Channel.
* Fix object leak.
- Lambdas are not being released automatically.
* Add doc for the constant that is being used.
- Address review comment
* Clean up SendAsync method.
- Validate the message type.
- Validate the array segment that is passed as the message.
* Add validation to ReceiveAsync for invalid buffer.
- remove unnecessary null checks from message buffering.
* Address review comments
* Address review comments about TCS
* Address camel case by using enum
* Address abort request
* Handle nullable
* Address review comment for removing cancellationtoken registration to the connect source.
* Use non-generic TaskCompletionSource
* Cleanup var usage
* Add string to .resx
* Inline dispose
* Fix WebSocket opening exception
* Remove the asynchronous completion from SendAsync.
* Fix object leak, exception on close and address review comments
* Handle race condition
* Address TaskCompletionSource on connect review comments
* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
* Fix Connect not completing task on error.
* Cleanup reference
* Remove redundant error check of memorystream buffer.
* cleanup
* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
Co-authored-by: Maxim Lipnin <mlipnin@gmail.com>
* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
Co-authored-by: Maxim Lipnin <mlipnin@gmail.com>
* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
Co-authored-by: Maxim Lipnin <mlipnin@gmail.com>
* Update src/libraries/System.Net.WebSockets.Client/src/System.Net.WebSockets.Client.csproj
Co-authored-by: Maxim Lipnin <mlipnin@gmail.com>
* Fix typo
* clean up buffer code
* Modify callbacks to use lambda function.
- These are now released properly after reference counting went in.
* Fix object leak of delegate and clean up deprecated code.
* extract lambda into method
* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Review comments addressed
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
Co-authored-by: Maxim Lipnin <mlipnin@gmail.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>