Skip to content

[Enhancement] Add ASP.NET Core middleware for streaming transcription endpoints #411

@deepgram-robot

Description

@deepgram-robot

Summary

Add an ASP.NET Core middleware component that makes it trivial to add real-time transcription WebSocket endpoints to any ASP.NET Core web application — handling WebSocket upgrade, audio streaming to Deepgram, and transcript delivery back to the client with minimal configuration.

Problem it solves

.NET developers building web applications that need real-time transcription must manually implement WebSocket handling, audio buffering, Deepgram connection management, and transcript forwarding in every project. This involves significant boilerplate: WebSocket middleware registration, binary message handling, connection lifecycle management, and error handling. An ASP.NET Core middleware that handles the Deepgram WebSocket proxy pattern lets developers add transcription to their app with a few lines in Program.cs, similar to how middleware exists for authentication, CORS, and other cross-cutting concerns.

Proposed API

// Program.cs — add transcription endpoint in 3 lines
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDeepgramTranscription(options => {
    options.ApiKey = builder.Configuration["Deepgram:ApiKey"];
    options.Model = "nova-3";
    options.Language = "en";
});

var app = builder.Build();
app.MapDeepgramTranscription("/ws/transcribe"); // WebSocket endpoint
app.Run();

// Client connects to /ws/transcribe, sends audio, receives transcripts
// Middleware handles: WebSocket upgrade, audio forwarding, transcript relay

Acceptance criteria

  • Provides AddDeepgramTranscription() service registration extension
  • Provides MapDeepgramTranscription() endpoint mapping extension
  • Handles WebSocket upgrade and binary audio forwarding to Deepgram
  • Relays transcript JSON back to the connected client
  • Supports configuration via IConfiguration (appsettings.json)
  • Manages connection lifecycle (client disconnect, Deepgram disconnect, errors)
  • Documented with usage example
  • Compatible with existing SDK API

Raised by the DX intelligence system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions