{"id":38902184,"url":"https://github.com/heyehang/blazewave","last_synced_at":"2026-01-17T15:04:08.800Z","repository":{"id":306880224,"uuid":"1026935569","full_name":"heyehang/blazewave","owner":"heyehang","description":"High-performance, event-driven WebSocket library,en:https://deepwiki.com/heyehang/blazewave zh:https://zread.ai/heyehang/blazewave","archived":false,"fork":false,"pushed_at":"2025-12-23T11:38:20.000Z","size":867,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-24T22:19:08.759Z","etag":null,"topics":["event-driven","go","high-performance","websocket"],"latest_commit_sha":null,"homepage":"https://github.com/heyehang/blazewave","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heyehang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-27T00:09:11.000Z","updated_at":"2025-12-23T11:38:24.000Z","dependencies_parsed_at":"2025-10-19T14:21:22.187Z","dependency_job_id":"84f1c209-ed97-4fe5-af16-e43e4181806a","html_url":"https://github.com/heyehang/blazewave","commit_stats":null,"previous_names":["heyehang/blazewave"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/heyehang/blazewave","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyehang%2Fblazewave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyehang%2Fblazewave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyehang%2Fblazewave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyehang%2Fblazewave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyehang","download_url":"https://codeload.github.com/heyehang/blazewave/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyehang%2Fblazewave/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event-driven","go","high-performance","websocket"],"created_at":"2026-01-17T15:04:08.721Z","updated_at":"2026-01-17T15:04:08.785Z","avatar_url":"https://github.com/heyehang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔥 BlazeWave\n\n[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat\u0026logo=go\u0026logoColor=white)](https://golang.org)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt)\n[![Test Coverage](https://img.shields.io/badge/Coverage-65.3%25-brightgreen.svg)](https://github.com/heyehang/blazewave)\n\n\u003e **High-performance, event-driven WebSocket library for Go** ⚡\n\n[English](README.md) | [中文](README_zh.md)\n\nBlazeWave is a modern, production-ready WebSocket library inspired by and improved from [nhooyr/websocket](https://github.com/nhooyr/websocket). It provides blazing-fast performance with high-performance operations, smart buffer pooling, and comprehensive event handling.\n\n## ✨ Features\n\n- **🚀 Industry-Leading Performance**: 3.8× throughput increase, 2.7× latency optimization\n- **⚡ High-Performance Architecture**: Industry-leading high-performance WebSocket library\n- **🎯 Event-Driven**: Comprehensive event system with middleware support\n- **🛡️ Production Ready**: RFC 6455 compliant, compression support, robust error handling\n- **🔧 Developer Friendly**: Simple API, type safety, extensive testing (65.3% coverage)\n- **🌐 Cross Platform**: Support for Go 1.21+ on all major platforms including WASM\n\n## 📊 Performance Benchmarks\n\n\u003e **Test Environment**: Apple M1 Max (10-core), 32GB RAM, Go 1.24.5 darwin/arm64\n\n### ⚡ Zero-Copy Read/Write \u0026 Zero-GC Metrics\n\n**📊 Performance Metrics**\n\n| Metric | Value | Unit |\n|--------|-------|------|\n| **Throughput** | 82,650 | ops/sec (35.23 MB/s) |\n| **Latency** | 13,887 | ns/op (13.9 μs) |\n| **Memory** | 327 | B/op (16 allocs/op) |\n| **Efficiency** | 99.2% | (vs baseline) |\n\n### 🚀 Performance Comparison Matrix\n\n| Metric | Standard | Zero-Copy Read/Write \u0026 Zero-GC | Improvement | Multiplier |\n|--------|----------|-----------|-------------|------------|\n| **Throughput** | 37,077 ops/sec | 82,650 ops/sec | **+123%** ⚡ | **2.23×** |\n| **Latency** | 32,381 ns | 13,887 ns | **-57%** ⚡ | **2.33×** |\n| **Memory** | 742 B/op | 327 B/op | **-56%** ⚡ | **2.27×** |\n| **Allocations** | 32 allocs/op | 16 allocs/op | **-50%** ⚡ | **2.00×** |\n\n### 🏆 High-Performance Mode vs Other WebSocket Libraries\n\n#### 📊 Technical Features Comparison\n\n| Library | Zero-Copy Read/Write \u0026 Zero-GC | Buffer Pooling | Event-Driven |\n|---------|-------------------------------|----------------|--------------|\n| **BlazeWave** | ✅ Native Support | ✅ Smart Pooling | ✅ Comprehensive Events |\n| nhooyr/websocket | ❌ None | ❌ None | ❌ None |\n| gorilla/websocket | ❌ None | ❌ None | ✅ Basic Events |\n| fasthttp/websocket | ❌ None | ❌ None | ✅ Basic Events |\n\n#### 🎯 Core Advantages\n\n**🚀 BlazeWave Core Advantages**\n\n| Feature | Description | Advantage |\n|---------|-------------|-----------|\n| ⚡ **Zero-Copy Read/Write \u0026 Zero-GC** | Zero Memory Copy, Zero GC Pressure | Ultimate Performance |\n| 🚀 **Smart Buffer Pooling** | Cross-connection Memory Reuse, Reduced GC | Memory Efficiency |\n| 🎯 **Comprehensive Event System** | Middleware \u0026 Custom Events, Beyond Basic | Developer Experience |\n| 🛡️ **Production Ready** | RFC 6455 Compliant, Robust Error Handling | Enterprise Stability |\n| 🔧 **Developer Friendly** | Simple API, Type Safety, Extensive Testing | Quick Start |\n\n\n## 📦 Installation\n\n```bash\ngo get github.com/heyehang/blazewave\n```\n\n## ⚡ Performance Advantages\n\n### High-Performance Architecture\nBlazeWave's high-performance design eliminates unnecessary memory allocations:\n- **Direct Buffer Access**: High-frequency read/write operations bypass intermediate buffers\n- **Memory Pool Reuse**: Smart buffer pooling reduces GC pressure\n\n### Memory Efficiency\n- **Buffer Pooling**: Reusable buffers across connections\n- **Timer Pooling**: Reusable timers across connections\n- **GC-Friendly**: Reduced garbage collection overhead\n\n### High Throughput\n- **High Performance Processing**: Optimized message handling pipeline\n- **Sustained I/O**: Efficient network I/O processing\n- **Concurrency Optimization**: Buffer pool and timer optimization\n\n\n\n## 🚀 Quick Start\n\n\u003e **Note**: The following examples demonstrate standard mode usage. For zero-copy read/write \u0026 zero-GC mode advanced usage, please refer to [BlazeWave Pulse](https://github.com/heyehang/blazewave-pulse) or check local examples or unit tests.\n\n\u003e **💡 Tip**: Zero-copy read/write \u0026 zero-GC mode is achieved by using optimized buffer pools and shared timer pools, suitable for production environments.\n\n### Standard Mode\n\n#### Server\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \"net/http\"\n    \"github.com/heyehang/blazewave\"\n    // \"github.com/heyehang/blazewave/core/pool\"  // Required for zero-copy read/write \u0026 zero-GC mode\n    // \"github.com/heyehang/blazewave/core/timer\"  // Required for shared timer pool\n)\n\nfunc main() {\n    // Standard mode: use default configuration\n    server := blazewave.NewServer()\n    \n    // Zero-copy read/write \u0026 zero-GC mode: use custom buffer pools and shared timer pool\n    // rPool := pool.NewPool(64, 4*1024)\n    // wPool := pool.NewPool(64, 4*1024)\n    // sharedTimer := timer.NewTimer(100)  // Shared timer pool with capacity 100\n    // server := blazewave.NewServer(\n    //     blazewave.WithServerReaderPool(rPool),\n    //     blazewave.WithServerWriterPool(wPool),\n    //     blazewave.WithServerHeartbeatTimer(sharedTimer),\n    // )\n    \n    server.OnTextMessage(func(ctx context.Context, conn *blazewave.Conn, payload []byte) error {\n        log.Printf(\"Received: %s\", string(payload))\n        return conn.Write(ctx, blazewave.MessageText, payload)\n    })\n    \n    http.HandleFunc(\"/ws\", func(w http.ResponseWriter, r *http.Request) {\n        conn, err := server.Accept(w, r)\n        if err != nil {\n            log.Printf(\"Accept failed: %v\", err)\n            return\n        }\n        defer conn.Close(blazewave.StatusNormalClosure, \"\")\n    })\n    \n    log.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n```\n\n#### Client\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \"time\"\n    \"github.com/heyehang/blazewave\"\n    // \"github.com/heyehang/blazewave/core/pool\"  // Required for zero-copy read/write \u0026 zero-GC mode\n    // \"github.com/heyehang/blazewave/core/timer\"  // Required for shared timer pool\n)\n\nfunc main() {\n    ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n    defer cancel()\n    \n    // Standard mode: use default configuration\n    client := blazewave.NewClient()\n    \n    // Zero-copy read/write \u0026 zero-GC mode: use custom buffer pools and shared timer pool\n    // rPool := pool.NewPool(64, 4*1024)\n    // wPool := pool.NewPool(64, 4*1024)\n    // sharedTimer := timer.NewTimer(100)  // Shared timer pool with capacity 100\n    // client := blazewave.NewClient(\n    //     blazewave.WithClientReaderPool(rPool),\n    //     blazewave.WithClientWriterPool(wPool),\n    //     blazewave.WithClientHeartbeatTimer(sharedTimer),\n    // )\n    \n    // Register event handlers\n    client.OnConnect(func(ctx context.Context, conn *blazewave.Conn) error {\n        log.Println(\"Connected to server!\")\n        return nil\n    })\n    \n    client.OnTextMessage(func(ctx context.Context, conn *blazewave.Conn, payload []byte) error {\n        log.Printf(\"Received message: %s\", string(payload))\n        return nil\n    })\n    \n    client.OnDisconnect(func(ctx context.Context, conn *blazewave.Conn) error {\n        log.Println(\"Disconnected from server\")\n        return nil\n    })\n    \n    // Connect to server\n    conn, _, err := client.Dial(ctx, \"ws://localhost:8080/ws\", nil)\n    if err != nil {\n        log.Fatal(\"Dial failed:\", err)\n    }\n    defer conn.Close(blazewave.StatusNormalClosure, \"\")\n    \n    // Send message\n    err = conn.Write(ctx, blazewave.MessageText, []byte(\"Hello, BlazeWave!\"))\n    if err != nil {\n        log.Fatal(\"Write failed:\", err)\n    }\n    \n    // Keep connection alive for a while\n    time.Sleep(5 * time.Second)\n}\n```\n\n\n\n## 🏗️ Architecture\n\n**🏗️ BlazeWave Architecture Design**\n\n### Core Components\n\n```\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                            BlazeWave Core Architecture                      │\n├─────────────────────────────────────────────────────────────────────────────┤\n│                                                                             │\n│  ┌─────────────────┐    ┌─────────────────┐    ┌──────────────────┐         │\n│  │  Application    │    │   Connection    │    │   Processing     │         │\n│  │ • Event System  │◄──►│ • Zero-Copy I/O │◄──►│ • Frame Parsing  │         │\n│  │ • Middleware    │    │ • Buffer Pool   │    │ • Mask Processing│         │\n│  │ • Heartbeat     │    │ • Compression   │    │ • Validation     │         │\n│  └─────────────────┘    └─────────────────┘    └──────────────────┘         │\n│           │                       │                       │                 │\n│           ▼                       ▼                       ▼                 │\n│  ┌─────────────────┐    ┌─────────────────┐    ┌──────────────────┐         │\n│  │ Infrastructure  │    │ Optimization    │    │ Network Layer    │         │\n│  │ • Buffer Pool   │    │ • Zero-Copy     │    │ • TCP/WebSocket  │         │\n│  │ • Memory Reuse  │    │ • Zero-GC       │    │ • TLS Support    │         │\n│  │ • GC Optimized  │    │ • Event-Driven  │    │ • Hijacking      │         │\n│  └─────────────────┘    └─────────────────┘    └──────────────────┘         │\n│                                                                             │\n└─────────────────────────────────────────────────────────────────────────────┘\n```\n\n**Performance Optimization Notes**:\n- **Buffer Pool Reuse**: Shared buffers across connections, reducing high-frequency memory allocations and GC pressure\n- **Timer Pool Reuse**: Use `WithServerHeartbeatTimer()` and `WithClientHeartbeatTimer()` to share timer pools\n- **Zero-Copy Read/Write \u0026 Zero-GC Optimization**: Use optimized buffer pools and shared timer pools\n\n## 🎯 Best Practices \u0026 Reference Projects\n\n### Core Philosophy: Event-Driven Real-Time Applications\n\nBlazeWave is designed around the core philosophy of **event-driven real-time applications**. For the best implementation examples and production-ready patterns, check out our reference project:\n\n#### **[BlazeWave Pulse](https://github.com/heyehang/blazewave-pulse)** ⚡\n\n\u003e **The definitive reference implementation showcasing BlazeWave's core concepts**\n\n- **Real-time Collaboration**: Multi-user interactive applications\n- **Event-Driven Architecture**: Complete event system implementation\n- **Production Patterns**: Scalable, maintainable code structure\n- **Performance Optimization**: High-performance, buffer pooling\n\nThis project demonstrates the best practices for building high-performance, real-time applications with BlazeWave.\n\n## 📚 Available Demos\n\nCheck out our interactive examples:\n\n- **[Chat Demo](./examples/chat/)**: Real-time chat application with user management\n- ![Chat Demo](/examples/chat/static/chat_example.gif)\n- **[Shared Mascot](./examples/shared-mascot/)**: Collaborative mascot movement demo\n- ![Mascot Demo Animation](/examples/shared-mascot/static/mascot.gif)\n- **[More Examples](./examples/README.md)**: Complete list of available demos\n\n## 🙏 Acknowledgments\n\n- Inspired by and improved from [nhooyr/websocket](https://github.com/nhooyr/websocket)\n- Built with Go's excellent standard library\n\n## ⭐ Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=heyehang/blazewave\u0026type=Date)](https://star-history.com/#heyehang/blazewave\u0026Date)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**BlazeWave** - Where Fire Meets Wave ⚡\n\n[![GitHub stars](https://img.shields.io/github/stars/heyehang/blazewave?style=social)](https://github.com/heyehang/blazewave)\n[![GitHub forks](https://img.shields.io/github/forks/heyehang/blazewave?style=social)](https://github.com/heyehang/blazewave)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyehang%2Fblazewave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyehang%2Fblazewave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyehang%2Fblazewave/lists"}