WebSocket Pro Client

高性能 WebSocket 客户端,专为现代 Web 应用设计。
特性
- 🚀 自动重连 + 智能退避算法
- 💓 可配置心跳检测
- 🎯 消息优先级调度
- 📦 多连接池管理
- 🔍 完整的 TypeScript 支持
安装
npm install websocket-pro-client
yarn add websocket-pro-client
快速开始
import { createWebSocketManager } from "websocket-pro-client";
const manager = createWebSocketManager({
maxReconnectAttempts: 5,
});
const client = manager.connect("wss://api.example.com");
client.on("message", (data) => {
console.log("Received:", data);
});
client.send({ action: "subscribe" });
开发调试
npm test
npm run build
npm run demo
贡献指南
- Fork 仓库
- 创建特性分支 (
git checkout -b dev/feature/fix-xxx)
- 提交更改 (
git commit -am 'feat/fix xxx')
- 推送到分支 (
git push origin dev/feature/fix-xxx)
- 创建 Pull Request
许可证
MIT © 2023 BetaCatPro