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

Connect-RPC support? #937

Open
CJLees01 opened this issue Aug 20, 2024 · 2 comments
Open

Connect-RPC support? #937

CJLees01 opened this issue Aug 20, 2024 · 2 comments

Comments

@CJLees01
Copy link

I have been playing around with the gRPC server, and it looks great.

Any interest in supporting Connect in addition to gRPC? It is backwardly-compatible with gRPC but also supports the Connect protocol.

Generating connect code using Buf tooling is easy, and so the task here - I think - is to correctly register the Connect service with GoFr. Happy to try it out and see how far I get?

@vipul-rawat
Copy link
Member

Hey @CJLees01, will be happy to check this out

@kefniark
Copy link

Yes I totally +1 on this one.

The best I managed to do was to hack around with a middleware

func connectMiddleware() gofrHTTP.Middleware {
        // your connect path & http handler
	path, handler := v1.NewUserServiceHandler(services.NewUserService())

	return func(inner http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			if strings.HasPrefix(r.URL.Path, path) {
				handler.ServeHTTP(w, r)
			} else {
				inner.ServeHTTP(w, r)
			}
		})
	}
}

It works for simple request, but sadly only http1.x and not possible to make it work with any of the streaming capability, and I couldn't find a way to use h2c.

Sadly gofr is really not flexible or thought to be extensible, as a user we don't have much control on the http server or it's configuration.

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

3 participants