edgeport - v1.0.3
    Preparing search index...

    Function encodeConnect

    • Encodes a CONNECT packet for MQTT v3.1.1.

      Writes the fixed protocol name MQTT, protocol level 4, the connect-flags byte (clean session, and the username/password presence bits), the keep-alive, and the payload (client id, then any username and password). Lean on TLS for confidentiality; the credentials travel in cleartext inside this packet.

      Parameters

      • opts: ConnectOptions

        The client id, keep-alive, clean-session flag, and optional credentials.

      Returns Uint8Array

      The complete CONNECT packet bytes.

      If a field exceeds the wire size limits.

      1.0.0

      import { encodeConnect } from 'edgeport/mqtt';

      const bytes = encodeConnect({ clientId: 'edge-1', keepAliveSeconds: 60, cleanSession: true });