grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
860 stars 271 forks source link

[Error on web] #592

Closed wurikiji closed 1 year ago

wurikiji commented 1 year ago
- Implementing gRPC client with Flutter. - Works fine on desktop and mobile simulators. - Not work on a web 3.1.0 ## Repro steps 1. clone https://github.com/wurikiji/flutter-happy-path 2. `cd grpc_chat` 3. run `dart run bin/server.dart` to start gRPC server in terminal 4. run `flutter run -d chrome` to start flutter web app 5. Go to the website. Below the black divider is a TextField. Type anything and hit enter. Expected result: Can send message to the gRPC server, and gRPC server will echo it. Then, flutter will show the echo-ed message. Actual result: Error on terminal (or Debug Console) ## Details
mraleph commented 1 year ago

This package only implements gRPC server, not gRPC-Web server. If you want to use gRPC-Web you need a proxy which would convert the traffic from gRPC-Web to gRPC. See for example how we do it to run tests (we proxy through envoy)

https://github.com/grpc/grpc-dart/blob/master/test/grpc_web_server.dart