#mqtt-client #mqtt

sys paho-mqtt-sys

Low-level, unsafe Rust wrapper for the Paho MQTT C Client Library. This is part of the official Eclipse Paho Rust Client Library

13 releases (8 breaking)

new 0.10.1 Jan 22, 2025
0.9.0 Oct 25, 2023
0.8.1 Mar 20, 2023
0.7.1 Dec 20, 2022
0.2.0 Nov 21, 2018

#735 in Asynchronous

Download history 14801/week @ 2024-10-05 14539/week @ 2024-10-12 15913/week @ 2024-10-19 13402/week @ 2024-10-26 12241/week @ 2024-11-02 11430/week @ 2024-11-09 12716/week @ 2024-11-16 9378/week @ 2024-11-23 9903/week @ 2024-11-30 10655/week @ 2024-12-07 10117/week @ 2024-12-14 4625/week @ 2024-12-21 4201/week @ 2024-12-28 9292/week @ 2025-01-04 11050/week @ 2025-01-11 8679/week @ 2025-01-18

33,973 downloads per month
Used in 31 crates (2 directly)

EPL-2.0 license

13MB
320K SLoC

Rust 268K SLoC // 0.0% comments C 44K SLoC // 0.1% comments JavaScript 4.5K SLoC // 0.1% comments Python 3K SLoC // 0.1% comments Shell 125 SLoC // 0.2% comments Bitbake 61 SLoC // 0.3% comments RPM Specfile 58 SLoC Batch 11 SLoC // 0.3% comments

Low-level Eclipse Paho MQTT C Client Library Wrapper

docs.rs crates.io

An un-safe, low-level, wrapper around the Eclipse Paho C Library, which can be used to write Rust MQTT client library on memory-managed operating systems such as Linux/Posix, Mac, and Windows. This is primarily used by the Eclipse Paho Rust Library, which provides a safe Rust interface over this one.

This package can build the recommended version of Paho C automatically. This is the default behavior, which comes in withthe "bundled" feature. It uses the cmake crate which can also cross-compile the C library for most targets.

When not using the bundled build, it will attept to link to a pre-installed version of the library. It is fairly sensitive to the C version.

The current supported Paho C version is: v1.3.14

Configurable Features

The default features are: ["bundled", "ssl"]

The full set of features include the following:

  • "bundled" - Whether to build the Paho C library contained in the Git submodule. This is similar to the "vendored" feature in other Rust projects. If not selected, it will attempt to find and link to a pre-installed version of the Paho C library for the target.
  • "build_bindgen" - Whether to generate the C language bindings for the target using bindgen. If not set, the build will attempt to find and use pre-built bindings for the target.
  • "ssl" - Whether to enable the use of secure sockets and secure websocket connections.
  • "vendored-ssl" - Whether to build OpenSSL. This passes the "vendored" option to the openssl-sys crate. This also selects the "ssl" option, if not already set.

The bundled feature requires CMake and a C compiler for the target.

The vendored-ssl feature requires the target C compiler as well, but also requires Perl and make.

Using SSL/TLS

We use the openssl-sys crate which allows for modification of the OpenSSL library behavior through environment variables, such as specifying the location of the library or linking it statically.

For more information read the Rust OpenSSL Docs, carefully.

In particular:

  • If you use vendored-ssl, you need a C compiler for the target, Perl, and make.

  • If you don't use vendored-ssl, it will attempt to use a package manager on the build host to find the library: pkg-config on Unix-like systems, Homebrew on macOS, and vcpkg on Windows.

  • If all else fails, you may need to set the specific location of the library with an environment variable. For example, on Windows, you may need to do something like this:

    set OPENSSL_DIR=C:\OpenSSL-Win64

Dependencies