Flutter dart GRPC client - null safety

So we don’t know for sure if StreamServerEvents works for flutter - web

No, since it’s not supported. Only potential solutions I see would try setup gRPC Web, try to use the external ServerEventsClient JS Lib or port ServerEventsClient class to Dart.

Sorry, I don’t understand you. I had asked before a month for the server events in flutter web and followed your advice to use the gRPC. I’m trying to find my question (btw how I can filter only my questions in forum).
this answer of yours (maybe I did not understand it well?)

That’s for normal iOS/Android Flutter not Web where these are the only options I see:

my question was for flutter web (I had written that) and layoric had tried to answer on that with an example.
I would much appreciate a working example of how to setup gRPC Web or any other way to have server events in Dart - flutter web

I would much appreciate some advice and directions on the preferable ServiceStack technologies, in the following architecture.
Client = Flutter on web (page will be hosted in the ServiceStack API)

Nothing is going to change the fact that gRPC Web is not supported from Web as per the docs you’ve already read. The linked gRPC Docs for configuring Envoy are hosted at https://grpc.io/docs/tutorials/basic/web/#configure-the-envoy-proxy

Understood that. I would expect only from your side to have a working example of streamServerEvents with Envoy, only to avoid other surprises.

We’re not investing the effort because relatively no-one is going to go through the complexity of hosting a gRPC Web Proxy when nearly everyone would call HTTP APIs instead as per our recommendation in the docs.

Sorry, maybe I don’t understand . How to get Server Sent Events with HTTP APIs from dart ? do you propose to make polling ?

These options have not changed

port ServerEventsClient class to Dart. ?
sorry we are not specialists. Our specialization is in Call communications servers

ASP.Net Core supports gRPC-Web without the Envoy. server streaming. Why this is not applicable in our case ?

  • Support gRPC-Web alongside gRPC HTTP/2 in ASP.NET Core. This option uses middleware provided by the Grpc.AspNetCore.Web package.

@mythz please can you explain us what do you mean with that? how to do it in dart ?

if you’re not already using envoyproxy we instead recommended using ServiceStack HTTP JSON Services, made possible since ServiceStack’s gRPC Service implementations are also made available over REST-ful HTTP APIs

try to use the external ServerEventsClient JS Lib

I’ve already explained what that passage meant:

I know that probably we ask a lot, but I would much appreciate an example calling from Dart with javascript interop the ServerEventsClient, a long connection and how to return the events.
All of these in Dart are new for us and it is a very small part of our system, but very important.

That’s outside the scope of our support (that we neither have the spare capacity for). Quick search on Google on how to call a JS library from Dart led to this Reddit thread:

Which says to use the js library to call JS APIs from Dart https://pub.dev/packages/js

There’s also special mention of using js_facade_gen to convert TypeScript definition files to Dart which may help bootstrap. The .d.ts for the @servicestack/client TypeScript library is available index.d.ts.

I have searched in Google and I found directly the https://pub.dev/packages/js mentioned in Redis.
But I have a difficulty to understand how to setup the ServerEventsClient and return the events.
Thank you anyway . we will see what we can do or not

We were succesful with ASP.Net Core gRPC- web and dart gRPC- web, creating the protos with a tool (I think yours) without Envoy. Not Server Sent Events. Simply a gRPC connection and server streaming.

1 Like

Cool, nice to know that ASP.NET Core’s gRPC Web endpoint works as advertised.

Which sounds like you’re successful in using gRPC Server Stream Client to consume the ServerEventsFeature.