Skip to content

Conversation

@davthecodercom
Copy link

@davthecodercom davthecodercom commented Sep 28, 2025

Adding Support for gRPC #2946

Test

cd examples/grpc
cargo run
# Install grpcurl
brew install grpcurl

# Test unary call
grpcurl -plaintext -proto proto/greeter.proto -d '{"name": "World"}' localhost:50051 greeter.Greeter/SayHello
{
  "message": "Hello World! (from gRPC)"
}

# Test streaming call  
grpcurl -plaintext -proto proto/greeter.proto -d '{"name": "World"}' localhost:50051 greeter.Greeter/SayHelloStream
{
  "message": "Hello World (stream message 1)!"
}
{
  "message": "Hello World (stream message 2)!"
}
{
  "message": "Hello World (stream message 3)!"
}
{
  "message": "Hello World (stream message 4)!"
}
{
  "message": "Hello World (stream message 5)!"
}

Test HTTP endpoints:

curl http://localhost:8000/
curl http://localhost:8000/stats

Key Features

  1. Dual Protocol Support: Serve both HTTP and gRPC from the same application
  2. Shared State: Access Rocket's managed state from gRPC services
  3. Streaming Support: Full support for unary and streaming gRPC methods
  4. Easy Integration: Uses Rocket's fairing system for seamless integration
  5. Tonic Integration: Built on top of the tonic gRPC library

@davthecodercom davthecodercom changed the title Proposal for gRPC using Tonic Proposal for Support gRPC using Tonic Sep 28, 2025
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

Successfully merging this pull request may close these issues.

1 participant