Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WebSockets version in ConnectionFactory #1

Open
ScottKane opened this issue May 31, 2022 · 0 comments
Open

Support WebSockets version in ConnectionFactory #1

ScottKane opened this issue May 31, 2022 · 0 comments

Comments

@ScottKane
Copy link

ScottKane commented May 31, 2022

For some reason a normal System.Net.Sockets.Socket isn't supported in WASM (I thought it was but it turns out the browser doesn't support sockets), is there any chance you can support using System.Net.WebSockets on the ConnectionFactory so that this can properly be used in WASM Blazor applications?

Here is an example of the issue (this app is using preview versions of GrpcLite from your myget feed): https://github.com/ScottKane/GrpcLiteWasm

You should be able to run this app and see normal behaviour, however if you uncomment the code in Client\Program.cs, when you run, the app will throw an exception in the browser:

System.AggregateException: One or more errors occurred. (System.Net.Sockets is not supported on this platform.)
 ---> System.PlatformNotSupportedException: System.Net.Sockets is not supported on this platform.
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at ProtoBuf.Grpc.Lite.ConnectionFactory.<>c__DisplayClass2_0.<<ConnectSocket>b__0>d.MoveNext() in /_/src/protobuf-net.GrpcLite/ConnectionFactory.cs:line 75
--- End of stack trace from previous location ---
   at ProtoBuf.Grpc.Lite.ConnectionFactory.<>c__DisplayClass13_0.<<AsStream>b__0>d.MoveNext() in /_/src/protobuf-net.GrpcLite/ConnectionFactory.cs:line 346
--- End of stack trace from previous location ---
   at ProtoBuf.Grpc.Lite.ConnectionFactory.<>c__DisplayClass12_0`1.<<AsFrames>b__0>d[[System.Net.Sockets.NetworkStream, System.Net.Sockets, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() in /_/src/protobuf-net.GrpcLite/ConnectionFactory.cs:line 327
--- End of stack trace from previous location ---
   at ProtoBuf.Grpc.Lite.ConnectionFactory.CreateChannelAsync(Func`2 factory, CancellationToken cancellationToken) in /_/src/protobuf-net.GrpcLite/ConnectionFactory.cs:line 427
   at Program.<Main>$(String[] args) in D:\Repos\GrpcLiteWasm\Client\Program.cs:line 18
   --- End of inner exception stack trace ---
@ScottKane ScottKane changed the title Allow a ClientWebSocket version in the ConnectionFactory Support WebSockets version in ConnectionFactory Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant