aedes-server-factory is a utility library designed to simplify the creation and configuration of various server types for the Aedes MQTT broker. It currently supports TCP, HTTP, HTTP2, WebSockets (WS), and PROXY decoders, with ongoing work for TLS, HTTPS, and WSS. The latest stable version is 0.2.1, with releases happening infrequently, often driven by bug fixes or minor feature enhancements related to server handling. Its primary differentiator is providing a consolidated API to instantiate and bind Aedes to different network protocols and server technologies, abstracting away the boilerplate involved in connecting an MQTT broker to diverse client interfaces. It offers flexible options for secure connections and proxy support.
npm install aedes-server-factoryVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating both a default TCP MQTT server and a WebSocket server using an underlying HTTP server with aedes-server-factory.
Review your WebSocket error handling. The `customWSErrorHandler` option can be used to provide specific error management. Monitor for new releases addressing this comprehensively.
Ensure you are interacting with the correct server instance returned by `createServer`. For WebSocket setups, the returned object is the HTTP server providing the WebSocket upgrade path.
Thoroughly test TLS/HTTPS/HTTP2/WSS configurations in non-production environments. Check the latest GitHub issues and pull requests for status updates and potential workarounds or recommended alternative approaches for production deployments.
Ensure `aedes` is correctly initialized via `const aedes = require('aedes')()` or `import Aedes from 'aedes'; const aedes = Aedes();` before passing it to `createServer`.Change the port number to an available one, or identify and terminate the process currently occupying the port (e.g., `lsof -i :1883` on macOS/Linux or `netstat -ano | findstr :1883` on Windows).
Verify that `ws: true` is correctly passed in the options to `createServer` and that the `ws` package is installed (`npm install ws`). Also, check your client-side WebSocket URL and protocol for correctness.