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

[question] ConnectRPC interfaces for proxy stream available but unable to do http proxy stream #899

Open
ruijietey opened this issue Oct 11, 2024 · 2 comments

Comments

@ruijietey
Copy link

ruijietey commented Oct 11, 2024

[Question]
Hi, I've previously implemented pbgrpc.CentrifugoProxyServer with GRPC protobuf for (i) SubscribeUnidirectional and (ii) SubscribeBidirectional. However, recently I would want to consider migrating to ConnectRPC because:

  1. most of our other API endpoints are using ConnectRPC
  2. I would want to leverage on our internal authentication / authorization envoys on ConnectRPC, so that the streaming can be intercepted with proper auth control

I see that centrifugo/proxyproto connectrpc generated protobufs are available on https://buf.build/centrifugo/proxyproto/sdks, hence I was experimenting on it and migrated the streaming server to use ConnectRPC instead of GRPC. After re-deploying both centrifugo service and our streaming server, I just realised that only GRPC endpoints are supported. I would want to check if ConnectRPC proxy streaming will be supported soon? Or currently is there any way to implement this on ConnectRPC?

...
[Example]
After implementing our streaming server to use ConnectRPC with proper configuration to the connectrpc HTTP endpoints, the centrifugo service will have these errors:

{"level":"fatal","time":"2024-10-11T07:39:28Z","message":"error creating subscribe stream proxy stream_logs_pod only GRPC endpoints supported"}

Please let me know if any other details needed, thanks in advanced for your help!

@FZambia
Copy link
Member

FZambia commented Oct 11, 2024

Hello @ruijietey

Centrifugo does not integrate with ConnectRPC now, we have Protobuf definitions in Buf registry only to provide an access to generated Protobuf structures from different languages without the need to generate them manually - which was requested recently by some Centrifugo user.

So you can expect any kind of issues with ConnectRPC at this point.

And while we have our own support for both HTTP/GRPC interfaces for most methods of Centrifugo server API and Centrifugo proxy API, SubscribeUnidirectional/SubscribeBidirectional only work over GRPC at this point.

At the same time, I'd really would like to integrate with ConnectRPC for Centrifugo server API and event proxy functionalities. We are actually very close to ConnectRPC protocol now - supporting native GRPC, but have custom HTTP which re-uses Protobuf schema (so we generally do what Buf ConnectRPC does, but we have our own implementation started before ConnectRPC existed and become popular).

I am not sure about all the gotchas in such integration at this point. Generally, Centrifugo should be very close to work with ConnectRPC, but:

  • we have custom Raw type which represents bytes or json.RawMessage in GRPC or HTTP contexts - this may be the complexity
  • for bidirectional streaming in HTTP case the connection between Centrifugo and the backend must be HTTP/2 - it may add some configuration overhead.
  • we do not use the same HTTP paths ConnectRPC uses - this does not seem a big deal to support both though
  • probably a mismatch/difficulty in how Centrifugo proxies original connection headers in proxy events

At some point I may take a look whether it's viable to integrate fully with ConnectRPC, any help will be appreciated in this.

@ruijietey
Copy link
Author

Hi @FZambia

Thanks for the prompt response and clarifications. I've understood about the constraints currently and will be using gRPC directly for the time being. Since I'm still pretty new to Centrifugo, I'll try to spend more time and understand more about Centrifugo first, and see what I can do regarding contributing to the integration of Centrifugo with ConnectRPC in the future.

Once again thank you!

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

2 participants