What problem does it solve?
This skill provides comprehensive guidance for implementing, debugging, and discussing WebSocket connections for Nostr relays, anchored in RFC 6455 and production-ready patterns. It consolidates protocol fundamentals, lifecycle management, and language-specific implementations to help engineers build robust relay infrastructure.
Core Features & Use Cases
- RFC 6455 Foundations: Deep dive into websocket framing, handshake, masking, keep-alive, close handshake, and error handling.
- Relay Lifecycle & Architecture: Best practices for per-connection state, subscription broadcasting patterns, and multi-language implementation tips (Go with khatru, C++ with strfry, Rust with nostr-rs-relay).
- Language-Specific Patterns: Concrete patterns for dual goroutine readers/writers, mutex-protected writes, safe broadcasting, and per-connection isolation.
- Use Case: Build a high-performance Nostr relay capable of thousands of concurrent connections with robust resource management and observability.
Quick Start
Use this skill to understand and implement Nostr WebSocket relays; start by reviewing RFC 6455 basics and then apply language-specific patterns for Go, C++, or Rust.