ts-proto
ts-proto copied to clipboard
feat: Grpc web stream (Promise/Observable)
Support grpc-web Promise stream and Observable stream.
- add grpc-web-promise-stream test example(test Promise stream)
- add grpc-web-observable-stream example(test Observable stream)
- add grpc-web-go-stream-server example (test server backend)
Note
If you use returnObservable options all service methods will return Observable type. Without this parameter, it will default to Promise type.
That is, if returnObservable is specified, there will be no return type of Promise, and vice versa.
This will cause the original generated code to be changed, like the previous generated code, server stream method will return Observable regardless of whether returnObservable is specified or not. (#337 )
cc @paralin
try to add grpcWebMixObservable options default is true. It mean:
- unary method use Promise response type.
- client streaming or server streaming use Observable response type.
- default parameters.txt is
outputClientImpl=grpc-webequal tooutputClientImpl=grpc-web,returnObservable=false,grpcWebMixObservablePromise=true
If you want all method return Observable response type, only set
outputClientImpl=grpc-web,returnObservable=true.
If you want all method return Promise response type, setting:
outputClientImpl=grpc-web,grpcWebMixObservablePromise=false.
If you use
returnObservable optionsallservice methodswill returnObservabletype. Without this parameter, it will default toPromisetype. That is, ifreturnObservableis specified, there will be no return type ofPromise, and vice versa.This will cause the original generated code to be changed, like the previous generated code,
server stream methodwill returnObservableregardless of whetherreturnObservableis specified or not. (#337 )
This break change already compatiable by grpcWebMixObservablePromise options.
@stephenh You can take a look, it's nice to merge into master. Thanks!!
Hey @luhuaei I'll try to have a look at this soon. Big patch, lots to review
Hey @luhuaei I'll try to have a look at this soon. Big patch, lots to review
Thanks! If you have any questions, feel free to ask.
Hi, Any news here? We also need streaming support