What problem does it solve?
WebSocket connections can remain open after they are no longer needed, causing resource leaks, duplicated listeners, and hung promises. This Skill explains when to close sockets and how to support external cancellation so long-lived subscriptions reliably terminate on success, timeout, error, or caller abort.
Core Features & Use Cases
- Explicit lifecycle rules: When to immediately close a socket (success, timeout, error, external cancel) to avoid leaks.
- AbortSignal integration: Accept and respond to AbortSignal to allow callers (for example React components) to cancel listeners on unmount.
- Unified cleanup: Clear timers, remove listeners, and close sockets idempotently to prevent double resolve/reject and race conditions.
- Use case: Implement a real-time transaction subscription that resolves when a target event arrives, rejects on error, times out after N milliseconds, and cancels when the user navigates away.
Quick Start
Use the websocket skill to wrap a WebSocket subscription with an AbortSignal so it closes cleanly on success, timeout, error, or external abort.