websocket-patterns

Configure Nginx reverse proxy and JWT authentication for WebSocket connections.

Updated Mar 2, 2026
One-click install
npx skills add https://github.com/MassimilianoPili/claude-code-config --skill websocket-patterns-massimilianopili
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: websocket-patterns
Source: https://github.com/MassimilianoPili/claude-code-config/tree/main/skills/websocket-patterns
Command: npx skills add https://github.com/MassimilianoPili/claude-code-config --skill websocket-patterns-massimilianopili

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive patterns and solutions for implementing, securing, and debugging WebSocket connections, crucial for real-time features in modern web applications.

Core Features & Use Cases

  • Nginx WebSocket Proxying: Configure Nginx for seamless WebSocket traffic handling, including essential headers and timeouts.
  • Authentication: Implement secure JWT authentication for WebSocket connections via query parameters.
  • Binary Protocol Handling: Manage binary protocols like ttyd for terminal integration.
  • Real-time Services: Integrate new real-time services behind an Nginx proxy.
  • Debugging: Troubleshoot common WebSocket connection issues.

Quick Start

Use the websocket-patterns skill to configure an nginx reverse proxy for a WebSocket service.

Frequently Asked Questions about websocket-patterns

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

FAQPage Schema
How do I configure Nginx as a reverse proxy for WebSocket traffic?▼

WebSocket JWT authentication is commonly implemented by passing tokens via query parameters during the initial handshake, allowing the server to validate user identity before accepting the real-time connection.

How do I handle binary protocols like ttyd in a WebSocket connection?▼

Handling binary protocols over WebSocket requires configuring the connection to transmit Buffer or ArrayBuffer data types, enabling terminal integration with tools like xterm.js for real-time interactive sessions.

Why does my WebSocket connection drop behind an Nginx proxy?▼

WebSocket connections drop behind Nginx proxies due to missing Upgrade headers or default timeout limits; implementing heartbeat mechanisms and adjusting proxy_read_timeout resolves these persistent connection issues.

Can I integrate xterm.js with a Node.js WebSocket server for terminal access?▼

Yes, you can integrate xterm.js with a Node.js WebSocket server by proxying binary protocol data streams directly to the terminal frontend, enabling real-time interactive command-line sessions in the browser.