Skip to the content.

PoC gRPC using .NET

This repository demonstrates a Proof of Concept (PoC) implementation of gRPC using .NET, focusing on server-sent events. It includes both the server and client implementations, illustrating how to build and consume gRPC services for real-time event streaming.


Features


Project Structure


Architecture

Sequence Diagram: gRPC Server-Sent Events

sequenceDiagram
    actor Client
    participant GrpcSSEClient as gRPC Client
    participant GrpcSSE as gRPC Server
    participant EventService

    Client->>GrpcSSEClient: Start Client
    GrpcSSEClient->>GrpcSSE: Connect to Server
    GrpcSSE->>EventService: Handle Subscription
    loop Stream Events
        EventService->>GrpcSSEClient: Send Event Data
    end
    GrpcSSEClient->>Client: Display Event Data

Class Diagram: gRPC Server and Client

classDiagram
    class GrpcSSE {
        +ConfigureServices(IServiceCollection services)
        +Configure(IApplicationBuilder app, IWebHostEnvironment env)
    }
    class EventService {
        +Subscribe(SubscribeRequest request, IServerStreamWriter<EventResponse> responseStream, ServerCallContext context)
    }
    class GrpcSSEClient {
        +Main(string[] args)
    }
    GrpcSSE o-- EventService
    GrpcSSEClient <|-- GrpcSSE

Prerequisites


Setup and Run

  1. Clone the repository:

    git clone https://github.com/your-username/grpc-poc-dotnet.git
    cd grpc-poc-dotnet
    
  2. Restore dependencies:

    dotnet restore
    
  3. Run the server:

    cd GrpcSSEServer
    dotnet run
    
  4. Run the client:

    cd GrpcSSEClient
    dotnet run
    


License

This project is licensed under the MIT License. See the LICENSE file for details.