Skip to content

Add WebSocket support template #34

Description

@PAMulligan

Description

Add WebSocket support to the project templates. Hono supports WebSocket connections on both Cloudflare Workers (via Durable Objects) and Node.js — this extends Nerva beyond pure REST APIs.

Why

Real-time features (notifications, live updates, chat) are increasingly common in modern APIs. WebSocket support makes Nerva suitable for a broader range of applications without requiring users to bring a separate real-time framework.

Acceptance Criteria

  • Add a WebSocket middleware template for Node.js
  • Add a WebSocket + Durable Objects template for Cloudflare Workers
  • Create example WebSocket handlers (connection, message, close events)
  • Add typed message schemas using Zod
  • Include a WebSocket health check / ping-pong handler
  • Add integration tests for WebSocket connections
  • Document WebSocket patterns in generated project README
  • Update `pipeline.config.json` to support WebSocket endpoint definitions
  • CI passes

Implementation Notes

Hono's WebSocket helper:
```typescript
import { upgradeWebSocket } from 'hono/cloudflare-workers';
// or
import { createNodeWebSocket } from '@hono/node-ws';

app.get('/ws', upgradeWebSocket((c) => ({
onMessage(event, ws) { /* handle message / },
onClose() { /
cleanup */ },
})));
```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions