nostr-websocket

Implement and debug Nostr Relay WebSocket connections using RFC 6455.

9|11|Updated Mar 8, 2025
One-click install
npx skills add https://github.com/PlebeianApp/market --skill nostr-websocket-plebeianapp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nostr-websocket
Source: https://github.com/PlebeianApp/market/tree/main/.claude/skills/nostr-websocket
Command: npx skills add https://github.com/PlebeianApp/market --skill nostr-websocket-plebeianapp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about nostr-websocket

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

FAQPage Schema
How do I implement a Nostr relay WebSocket connection following RFC 6455?

Managing per-connection state in Nostr WebSocket relays requires thread-safe patterns like mutex-protected writes and per-connection isolation to handle thousands of concurrent connections without data races or resource exhaustion.

How does RFC 6455 framing work for Nostr relay WebSocket connections?

Nostr relay WebSocket connections require RFC 6455 framing, upgrade handshakes, masking, keep-alive, and close handshakes to ensure protocol correctness and robust error handling for production-ready relays.

What is the best way to handle subscription broadcasting in a Nostr relay?

Safe subscription broadcasting in Nostr relays requires per-connection state isolation and thread-safe patterns like mutex-protected writes to deliver messages correctly across thousands of concurrent WebSocket connections.

Can I use khatru to build a production-ready Nostr relay in Go?

You can use khatru to build a production-ready Nostr relay in Go by applying dual goroutine readers, mutex-protected writes, and per-connection isolation patterns for robust, high-performance concurrent WebSocket connections.

Does nostr-rs-relay support thread-safe WebSocket writes for concurrent connections?

Nostr-rs-relay supports thread-safe WebSocket writes through language-specific Rust patterns including mutex-protected writes and per-connection isolation to manage thousands of concurrent connections safely.

Why do my Nostr relay WebSocket connections drop under high concurrent load?

Nostr relay WebSocket connections drop under high load when lacking proper per-connection lifecycle management, thread-safe broadcasting patterns, and robust resource isolation needed to sustain thousands of concurrent connections.