ExMqtt.Transport.WebSocket (ex_mqtt_uv v0.1.0)

Copy Markdown View Source

Zero-dependency RFC 6455 WebSocket transport (ws:// and wss://) for MQTT over WebSocket.

Implements HTTP/1.1 Upgrade handshake (Sec-WebSocket-Protocol: mqtt), client-side frame masking, fragmented binary frame reassembly, and automatic WebSocket Ping/Pong and Close control-frame handling.

Options

  • :host (required) - Broker hostname or IP
  • :port - Port (default 80 for ws, 443 for wss)
  • :path - WebSocket path (default "/mqtt")
  • :tls - Boolean enabling wss:// via :ssl (default false)
  • :subprotocol - WebSocket subprotocol (default "mqtt")
  • :headers - Extra [{name, value}] HTTP headers for the Upgrade request
  • :socket_opts / :ssl_opts - Extra options forwarded to :gen_tcp / :ssl