$ show KSDaemon/wampy.js
This repository is a mature, production-grade WAMP v2 client library for Node.js and browsers. The actual code implements the Web Application Messaging Protocol with full pub/sub and RPC support over WebSocket, including auto-reconnect, multiple serializers (JSON, CBOR, MsgPack), and authentication methods (ticket, WAMP-CRA, cryptosign). The architecture is modular: a core Wampy class in `src/wampy.ts` accepts pluggable serializers via a common interface, and authentication plugins are registered in a hashmap. The library also includes a CLI tool (`cmd/cli.ts`) for rapid WAMP API debugging. External dependencies are minimal (WebSocket, Node.js crypto for cryptosign). The codebase is written in TypeScript with strict mode, dual ESM/CJS builds, and a comprehensive test suite covering connectivity, PubSub, RPC, and advanced features like progressive calls and Payload PassThru Mode. Despite large test files and some legacy patterns, the code is well-structured and follows promises/async-await throughout.
The LLM identified 1 files worth highlighting for reuse:
Defines a `Serializer` interface and factory/builder for serializers (JSON, CBOR, MsgPack). The design is clean and minimal, allowing any custom serializer to be plugged in via `Wampy({ serializer: new MySerializer() })`. It is self-contained, has no internal dependencies, and could be extracted to implement custom serialization in any project requiring pluggable encode/decode logic.