go-websocket

Establish real-time WebSocket communication patterns for Go backends using Chi.

1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/anicdh/agstack --skill go-websocket
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go-websocket
Source: https://github.com/anicdh/agstack/tree/main/.claude/skills/go/go-websocket
Command: npx skills add https://github.com/anicdh/agstack --skill go-websocket

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

WebSocket real-time communication patterns for Go backends using Chi and nhooyr.io/websocket enable bidirectional, low-latency communication for live features such as chat, dashboards, and collaborative tools.

Core Features & Use Cases

  • Connection upgrade with Chi and authentication before upgrade.
  • Hub/Room pattern for broadcast with safe concurrent writes.
  • Read/Write pumps with context cancellation and deadlines.
  • Heartbeat with Ping/Pong to detect dead connections.
  • Graceful shutdown and error handling with close codes.

Quick Start

Implement a WebSocket endpoint in a Go server using Chi and nhooyr.io/websocket following the patterns described.

Frequently Asked Questions about go-websocket

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add WebSocket real-time communication to a Go backend using Chi?▼

To add WebSocket real-time communication to a Go Chi backend, you establish a connection upgrade with pre-upgrade authentication, then use read/write pumps with context cancellation and deadlines for bidirectional low-latency messaging.

What is the best way to handle concurrent WebSocket writes and dead connections in Go?▼

The best way to handle concurrent WebSocket writes and dead connections in Go is implementing a Hub/Room pattern for safe concurrent broadcasts alongside a heartbeat with Ping/Pong to detect and drop dead connections.

Does nhooyr.io/websocket support graceful shutdown and RFC6455-compliant framing?▼

Yes, nhooyr.io/websocket supports graceful shutdown with proper error handling and close codes, while fully satisfying requirements for RFC6455-compliant framing and typed message protocols in Go servers.

How do I implement a single writer per connection for WebSocket chat features in Go?▼

To implement a single writer per connection for WebSocket chat features in Go, you use dedicated read/write pumps with context cancellation and deadlines to serialize message delivery and prevent concurrent write conflicts.

When do I need WebSocket patterns like read/write pumps with deadlines for my Go server?▼

You need WebSocket patterns like read/write pumps with deadlines for your Go server when delivering live updates for dashboards, collaborative apps, or chat features that require robust bidirectional messaging and graceful shutdown.