hammerspoon2-docs
    Preparing search index...

    Function create

    • Creates an MQTT client. The client doesn't connect until you call its connect() method. mqtt:// (TCP, port 1883), mqtts:// (TLS, port 8883), ws:// (WebSocket, port 80) or wss:// (WebSocket over TLS, port 443). A URL may include a port, a username and password (mqtt://user:pass@host), and for WebSockets a path (defaults to /mqtt).

      Parameters

      • server: string

        The broker's host name or URL

      • Optionaloptions: {
            allowUntrustedCertificates?: boolean;
            caCertificate?: string;
            cleanSession?: boolean;
            clientCertificate?: string;
            clientCertificatePassword?: string;
            clientID?: string;
            connectTimeout?: number;
            keepAlive?: number;
            password?: string;
            port?: number;
            reconnectInterval?: number;
            timeout?: number;
            tls?: boolean;
            username?: string;
            version?: "5" | "3.1.1";
            websocket?: boolean;
            websocketPath?: string;
            will?: {
                payload?: string;
                qos?: 0 | 2 | 1;
                retain?: boolean;
                topic: string;
            };
        }

        Connection options

      Returns HSMQTTClient | null

      A new HSMQTTClient, or null if the server or options are invalid (the reason is logged to the Console)