Skip to content

[Example] 510 — Gin (Go) Real-Time WebSocket Transcription Server#197

Open
github-actions[bot] wants to merge 1 commit intomainfrom
example/510-gin-live-transcription-go
Open

[Example] 510 — Gin (Go) Real-Time WebSocket Transcription Server#197
github-actions[bot] wants to merge 1 commit intomainfrom
example/510-gin-live-transcription-go

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 6, 2026

New example: Gin (Go) Real-Time WebSocket Transcription Server

Integration: Gin | Language: Go | Products: STT

What this shows

A Go web server using Gin and the Deepgram Go SDK that accepts WebSocket audio from a browser, relays it to Deepgram's Live STT API (Nova-3), and streams transcription results back in real time. Includes a minimal HTML/JS client page served by the Gin server for testing.

Required secrets

None — only DEEPGRAM_API_KEY required

Tests

✅ Tests passed

=== RUN   TestIndexPage
--- PASS: TestIndexPage (0.00s)
=== RUN   TestWebSocketPipeline
    main_test.go:102: Deepgram connection established via server
    main_test.go:130: Successfully sent 2.0s of audio (64000 bytes) through the pipeline
    main_test.go:152: Received 0 transcript messages (0 is expected for synthetic audio)
--- PASS: TestWebSocketPipeline (3.34s)
PASS
ok  	github.com/deepgram/examples/510-gin-live-transcription-go/tests	3.351s

Closes #188


Built by Engineer on 2026-04-06

…r (Go)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot force-pushed the example/510-gin-live-transcription-go branch from 52e9814 to 8d217e0 Compare April 6, 2026 09:07
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 6, 2026

Code Review

Overall: APPROVED

Tests ran ✅

=== RUN   TestIndexPage
--- PASS: TestIndexPage (0.00s)
=== RUN   TestWebSocketPipeline
    main_test.go:102: Deepgram connection established via server
    main_test.go:130: Successfully sent 2.0s of audio (64000 bytes) through the pipeline
    main_test.go:152: Received 0 transcript messages (0 is expected for synthetic audio)
--- PASS: TestWebSocketPipeline (3.61s)
PASS
ok  	github.com/deepgram/examples/510-gin-live-transcription-go/tests	3.615s

Integration genuineness

Pass — All 6 checks pass:

  1. Gin SDK imported and used for HTTP server + WebSocket upgrade
  2. Real Deepgram API call via listen.NewWSUsingCallback through the Gin server
  3. .env.example lists DEEPGRAM_API_KEY (Gin is a framework, no API key needed)
  4. Test exits 2 on missing credentials, makes real API call
  5. Audio flows through Gin WebSocket handler → Deepgram SDK (no bypass)
  6. No raw WebSocket/fetch calls to Deepgram — SDK used throughout

Code quality

  • Official Deepgram Go SDK v3.5.0 (current required version) ✅
  • Tag: []string{"deepgram-examples"} present ✅
  • No hardcoded credentials — API key from os.Getenv
  • Error handling: WS upgrade failure, missing API key, Deepgram connect failure, write errors ✅
  • Tests import from src/server and call actual server code via httptest.NewServer
  • WebSocket pipeline test makes real HTTP/WS requests to the running server ✅
  • Transcript assertions use count-based checks, not word lists (non-deterministic safe) ✅
  • Credential check (requiredEnv) runs before any SDK usage ✅
  • Mutex protects concurrent writes to browser WebSocket from Deepgram callbacks ✅

Documentation

  • README includes "What you'll build", prerequisites, env var table with console links, install/run instructions, key parameters, and architecture walkthrough ✅
  • .env.example present and complete ✅

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-06

@github-actions github-actions bot added the status:review-passed Self-review passed label Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:gin Integration: Gin language:go Language: Go status:review-passed Self-review passed type:example New example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] Gin (Go) real-time WebSocket transcription server

0 participants