hono-websockets

Implement cross-runtime WebSocket support in Hono applications with lifecycle events.

3|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/lucasilverentand/skills --skill hono-websockets
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hono-websockets
Source: https://github.com/lucasilverentand/skills/tree/main/skills/hono/websockets
Command: npx skills add https://github.com/lucasilverentand/skills --skill hono-websockets

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables real-time bidirectional WebSocket communication in Hono applications across multiple runtimes, simplifying the development of chat, live updates, and notifications.

Core Features & Use Cases

  • Unified WebSocket integration across Cloudflare, Bun, Deno, and Node.js.
  • Robust connection lifecycle management (open, message, close, error) and message broadcasting.
  • Built-in authentication support via tokens or cookies for secure upgrades.
  • Real-world use cases include chat apps, live notifications, and collaborative dashboards.

Quick Start

  • Create a Hono app and add a /ws route that uses upgradeWebSocket to handle onOpen, onMessage, and onClose.
  • Implement runtime-specific adapters (Cloudflare, Bun, Deno, Node.js) as shown in the documentation.
  • Run and test with a WebSocket client against the /ws endpoint.

Frequently Asked Questions about hono-websockets

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

FAQPage Schema
How do I set up WebSockets in a Hono application for real-time communication?

To set up WebSockets in a Hono application, add a /ws route using the upgradeWebSocket helper to handle onOpen, onMessage, and onClose lifecycle events for bidirectional real-time streaming. You then implement runtime-specific adapters to complete the integration.

Can I use Hono WebSockets across different runtimes like Cloudflare, Bun, Deno, and Node.js?

Yes, Hono WebSockets support cross-runtime functionality across Cloudflare, Bun, Deno, and Node.js. You can implement real-time bidirectional communication using runtime-specific adapters like hono.cloudflare-workers, hono/bun, hono/deno, and @hono/node-ws.

How do I authenticate WebSocket connections in Hono before upgrading?

You can authenticate WebSocket connections in Hono using built-in authentication hooks that support token or cookie validation. This ensures secure connection upgrades before the real-time bidirectional streaming channel is fully established.

What are common use cases for real-time WebSocket integration in Hono apps?

Common use cases for real-time WebSocket integration in Hono apps include building chat applications, live notifications, collaborative dashboards, and any scenario requiring robust bidirectional streaming and message broadcasting across multiple runtimes.

How do I manage connection lifecycle events and message broadcasting in Hono WebSockets?

Hono WebSockets provide robust connection lifecycle management by handling open, message, close, and error events. Within these hooks, you can implement message broadcasting to connected clients for real-time updates.

Does Hono WebSocket integration require specific dependencies for Node.js environments?

Yes, implementing WebSocket support in Node.js environments requires the @hono/node-ws adapter. Other runtimes use their respective adapters like hono/bun or hono/deno to enable real-time bidirectional communication.