grpc-ecosystem / grpc-spring

Spring Boot starter module for gRPC framework.
https://grpc-ecosystem.github.io/grpc-spring/
Apache License 2.0
3.43k stars 809 forks source link

directly support grpc-web #196

Open mwelser opened 5 years ago

mwelser commented 5 years ago

it would be great to support grpc-web with an in-process proxy instead of using a real proxy in between the frontend and the backend to translate grpc-web->proxy->grpc-server. direct communication support instead would be a great feature

ST-DDT commented 5 years ago

I will have a look at this, but it might take some time.

ST-DDT commented 5 years ago

@mwelser I have a few questions regarding the implementation of this feature.

ST-DDT commented 5 years ago

@mwelser I started the implementation in #207 . The PR is WIP, but it should be functional at least for simple use cases. Any feedback would be appreciated.

It is not likely that the feature will make it into the upcoming release 2.3.0 though.

Jarvis8099 commented 4 years ago

Server enabled Security, configure SSL why prompt “Security is enabled but this implementation does not support Security! ”?

ST-DDT commented 1 year ago

See also: https://mvnrepository.com/artifact/io.grpc/grpc-servlet

wirekang commented 1 year ago

Hi. I want to implement in-process proxy for grpc-web, but I can't figure out how to. Can you provide more information?

ST-DDT commented 1 year ago

I'm not sure what exactly you are asking for.

wirekang commented 1 year ago

I'm trying first way. How can I use grpc-servlet with grpc-spring-boot-starter? Despite it neglected for 3 years, does GrpcServlet works well? GrpcServlet requires all services and their urlPatterns. Should I pass all my service information manually? Is there a way to use netty instead of servlet using NettyServerBuilder?

ST-DDT commented 1 year ago

Despite it neglected for 3 years, does GrpcServlet works well?

AFAICT it was only added this year?

https://github.com/grpc/grpc-java/commits/master/servlet

GrpcServlet requires all services and their urlPatterns.

I dont see a way to configure urls:

https://github.com/grpc/grpc-java/blob/478f30e6458a72957106b44657608b9cd4ee6c1b/servlet/src/main/java/io/grpc/servlet/GrpcServlet.java#L53

Should I pass all my service information manually?

As for finding all your services you can leave that to the https://github.com/yidongnan/grpc-spring-boot-starter/blob/72159342ca2001a596cf32b4eb456478156eefbb/grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/service/GrpcServiceDiscoverer.java#L32 bean.

Is there a way to use netty instead of servlet using NettyServerBuilder?

Not via Netty Server Builder Afaict but with whatever means this code uses: https://github.com/grpc/grpc-java/blob/478f30e6458a72957106b44657608b9cd4ee6c1b/servlet/src/main/java/io/grpc/servlet/ServletServerBuilder.java#L100

Not sure if that actually starts a server or only the adapter. You might need a netty servlet dependency as well.