BU

Bun Enable compression for WebSocket messages

Configures WebSocket compression for Bun servers to reduce data transfer size.

Install

mkdir -p .claude/skills/bun-enable-compression-for-websocket-messages && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11774" && unzip -o skill.zip -d .claude/skills/bun-enable-compression-for-websocket-messages && rm skill.zip

Installs to .claude/skills/bun-enable-compression-for-websocket-messages

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Enable compression for WebSocket messages
41 charsno explicit “when” trigger
Beginner

Key capabilities

  • Enable per-message compression for WebSocket communication
  • Compress all WebSocket messages by default
  • Compress individual WebSocket messages selectively

How it works

The skill enables per-message compression by setting the perMessageDeflate parameter in Bun.serve, which uses the permessage-deflate WebSocket extension. It also allows manual compression for individual messages by passing true to ws.send().

Inputs & outputs

You give it
Bun.serve configuration with perMessageDeflate: true or ws.send(message, true)
You get back
Compressed WebSocket messages

When to use Bun Enable compression for WebSocket messages

  • Enabling compression for real-time WebSocket communication
  • Reducing bandwidth usage for large message payloads
  • Optimizing performance for high-traffic WebSocket servers

About this skill

Enable compression for WebSocket messages

Per-message compression can be enabled with the perMessageDeflate parameter. When set, all messages will be compressed using the permessage-deflate WebSocket extension.

Bun.serve({
  // ...
  websocket: {
    // enable compression
    perMessageDeflate: true,
  },
});

To enable compression for individual messages, pass true as the second parameter to ws.send().

Bun.serve({
  // ...
  websocket: {
    async message(ws, message) {
      // send a compressed message
      ws.send(message, true);
    },
  },
});

When not to use it

  • When the overhead of compression outweighs the benefits for small message payloads
  • When client-side WebSocket implementations do not support the permessage-deflate extension

Limitations

  • Compression relies on the permessage-deflate WebSocket extension

How it compares

This workflow automates WebSocket message compression through configuration or explicit function calls, unlike manual data compression before transmission.

Compared to similar skills

Bun Enable compression for WebSocket messages side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
Bun Enable compression for WebSocket messages (this skill)05moNo flagsBeginner
bullmq-specialist256moNo flagsIntermediate
managing-api-cache227dReviewAdvanced
rate-limiting-apis127dReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

bullmq-specialist

davila7

BullMQ expert for Redis-backed job queues, background processing, and reliable async execution in Node.js/TypeScript applications. Use when: bullmq, bull queue, redis queue, background job, job queue.

2595

managing-api-cache

jeremylongshore

Implement intelligent API response caching with Redis, Memcached, and CDN integration. Use when optimizing API performance with caching. Trigger with phrases like "add caching", "optimize API performance", or "implement cache layer".

220

rate-limiting-apis

jeremylongshore

Implement sophisticated rate limiting with sliding windows, token buckets, and quotas. Use when protecting APIs from excessive requests. Trigger with phrases like "add rate limiting", "limit API requests", or "implement rate limits".

15

prisma-connection-pool-exhaustion

blader

Fix Prisma "Too many connections" and connection pool exhaustion errors in serverless environments (Vercel, AWS Lambda, Netlify). Use when: (1) Error "P2024: Timed out fetching a new connection from the pool", (2) PostgreSQL "too many connections for role", (3) Database works locally but fails in production serverless, (4) Intermittent database timeouts under load.

14

generating-grpc-services

jeremylongshore

Generate gRPC service definitions, stubs, and implementations from Protocol Buffers. Use when creating high-performance gRPC services. Trigger with phrases like "generate gRPC service", "create gRPC API", or "build gRPC server".

13

azure-monitor-opentelemetry-ts

microsoft

Instrument applications with Azure Monitor and OpenTelemetry for JavaScript (@azure/monitor-opentelemetry). Use when adding distributed tracing, metrics, and logs to Node.js applications with Application Insights.

11

Search skills

Search the agent skills registry