Parameters
- server: string
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;
};
}
A new HSMQTTClient, or null if the server or options are invalid (the reason is logged to the Console)
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) orwss://(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).