Skip to main content

okiff-sdk

Python SDK for connecting to and communicating with MQTT brokers. Built as a compiled native extension for high performance and ease of deployment.


Requirements

  • Python 3.9 or later
  • Linux x86-64 / ARM64 (additional platforms coming soon)

Installation

pip install okiff-sdk

No compilation is required. The package is distributed as a pre-built binary wheel.


Quick Start

"""
Example:
    Connect to an MQTT broker, subscribe to a topic,
    publish a message, and receive messages using callbacks.
"""

import time
from okiff_sdk import SDK


# Create SDK instance
sdk = SDK()


# Connection callback
def on_connection(connected: bool, rc: int) -> None:
    """
    Called whenever the connection state changes.

    Args:
        connected: True if connected, False otherwise.
        rc: MQTT return code (0 = success, -1 = unexpected disconnect).
    """
    print(f"[on_connection] connected={connected}, rc={rc}")


# Message callback
def on_message(topic: str, payload: str) -> None:
    """
    Called when a message is received.

    Args:
        topic: MQTT topic.
        payload: UTF-8 message payload.
    """
    print(f"[on_message] topic={topic}, payload={payload}")


# Register callbacks
sdk.on_connection(on_connection)
sdk.on_message(on_message)


# Initialize SDK
sdk.init(
    clientId="clientId",
    brokerHost="ip/domain:port",
    protocol="tcp",
    username="username",
    password="YOUR_PASSWORD_or_JWT_TOKEN",
    caFile="",
    certFile="",
    keyFile="",
    cleanSession=True,
    resumeSubs=True,
    connectRetry=True,
    autoReconnect=True,
    connectRetryInterval=5,
    maxReconnectInterval=30,
    keepAlive=30,
    pingTimeout=20,
    writeTimeout=20,
    orderMatters=False,
    connectTimeout=5,
    edition="Enterprise",
)


# Connect
if sdk.connect():
    sdk.subscribe("okiff/sdk/test")
    sdk.publish("okiff/sdk/test", "hello from okiff-sdk")

    # Wait to receive messages
    time.sleep(5)


# Disconnect
sdk.disconnect()
print("Disconnected")

API Reference

SDK()

Creates a new SDK instance.


init(...)

Initializes the MQTT client. L'option edition Enterprise permet à connecter l'IoT Thing to the Cloud Core. For Testing you can use edition Community and connect to Edge/Onpremise Broker core.

This method must be called before connect().

Parameter Type Description
clientId str Unique MQTT client identifier
brokerHost str Broker address with port (host:port)
protocol str Connection protocol ("tcp" or "ssl")
username str MQTT username
password str MQTT password or JWT token
caFile str Path to the CA/trust-store certificate (for TLS/mTLS, e.g. "ssl" protocol). Defaults to "" (skip)
certFile str Path to the client certificate (for mTLS). Defaults to "" (skip)
keyFile str Path to the client private key (for mTLS). Defaults to "" (skip)
cleanSession bool Start a clean MQTT session
resumeSubs bool Restore subscriptions after reconnect
connectRetry bool Retry the initial connection if it fails
autoReconnect bool Automatically reconnect after disconnect
connectRetryInterval int Initial retry interval (seconds)
maxReconnectInterval int Maximum reconnect interval (seconds)
keepAlive int MQTT keep-alive interval (seconds)
pingTimeout int Ping response timeout (seconds)
writeTimeout int Socket write timeout (seconds)
orderMatters bool Preserve message ordering
connectTimeout int Connection timeout (seconds)
edition str SDK edition (for example "Community" or "Enterprise")

connect() -> bool

Connects to the configured MQTT broker.

Returns True if the connection succeeds.


disconnect()

Gracefully disconnects from the MQTT broker.


publish(topic, payload, qos=0, retained=False)

Publishes a message to the specified topic.

Parameter Type Description
topic str MQTT topic
payload str Message payload
qos int MQTT Quality of Service (0, 1 or 2)
retained bool Publish as a retained message

subscribe(topic, qos=0) -> bool

Subscribes to an MQTT topic.

Returns True if the subscription succeeds.


unsubscribe(topic)

Removes an existing topic subscription.


on_message(callback)

Registers a callback invoked whenever a message is received.

Callback signature:

callback(topic: str, payload: str) -> None

on_connection(callback)

Registers a callback invoked whenever the connection state changes.

Callback signature:

callback(connected: bool, rc: int) -> None

Where:

  • connected=True indicates the client is connected.
  • connected=False indicates the client has disconnected.
  • rc is the MQTT/Paho return code.

is_connected() -> bool

Returns the current connection status.


License

Proprietary — All rights reserved.

Metadata

Release files for okiff-sdk 1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for okiff-sdk 1.2.4
File Actions
okiff_sdk-1.2.4-cp314-cp314-manylinux_2_39_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.39+ x86-64 Details for okiff_sdk-1.2.4-cp314-cp314-manylinux_2_39_x86_64.whl
okiff_sdk-1.2.4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for okiff_sdk-1.2.4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
okiff_sdk-1.2.4-cp313-cp313-manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64 Details for okiff_sdk-1.2.4-cp313-cp313-manylinux_2_39_x86_64.whl
okiff_sdk-1.2.4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for okiff_sdk-1.2.4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
okiff_sdk-1.2.4-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details for okiff_sdk-1.2.4-cp312-cp312-manylinux_2_39_x86_64.whl
okiff_sdk-1.2.4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for okiff_sdk-1.2.4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Total release size: 12.9 MB

Release files / okiff_sdk-1.2.4-cp314-cp314-manylinux_2_39_x86_64.whl

Download URL okiff_sdk-1.2.4-cp314-cp314-manylinux_2_39_x86_64.whl
Size 2.5 MB
Tags CPython 3.14 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
ff4f4ef3134ec2280da6ddac3a960a0b63e8e47ba8f589d9a5258745b27ed83d
BLAKE2b-256 checksum
How to use checksums
fe534420bfb1fa37d950841141b8ca77395e2d74e981ac26cd2381c678f1452f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / okiff_sdk-1.2.4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL okiff_sdk-1.2.4-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.14 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
bb997bfa0c25957bad29ed5327b6571764ba83805880eb6d824dcb137ce43fe2
BLAKE2b-256 checksum
How to use checksums
02c5641c18bda6ba94b62a93e7e6470b021e723dadc143df21ed9e7ccd64768a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / okiff_sdk-1.2.4-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL okiff_sdk-1.2.4-cp313-cp313-manylinux_2_39_x86_64.whl
Size 2.5 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
74595b5111771e7f19fc1a4b971473e368422221f8a368f3a4ebfbeecd1e13d9
BLAKE2b-256 checksum
How to use checksums
c4a4da3e92ead4eec7c935a4dbed32252a9079a42937a1246ee4c5a849c35490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / okiff_sdk-1.2.4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL okiff_sdk-1.2.4-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4253f7eaab59584baf82a1f23f107a05b7136d0d78a918ebfc0059accc360a1a
BLAKE2b-256 checksum
How to use checksums
f0c8827c5b95b691c9ef621d304ef8bc026a44227c627d8f2018c3049d6edf62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / okiff_sdk-1.2.4-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL okiff_sdk-1.2.4-cp312-cp312-manylinux_2_39_x86_64.whl
Size 2.5 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
9770788bb63ae9d1371d57e0280a76d69059181e148e4e65b7cb4f479baa29cc
BLAKE2b-256 checksum
How to use checksums
05668f84804112374364ce81cc5a45fb3dce15cda22eb2508c0271e899ec32d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / okiff_sdk-1.2.4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL okiff_sdk-1.2.4-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.8 MB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
c905ed1f99f8efb09528c350898cb289237dc070b784c9dfc93bab5bfd766701
BLAKE2b-256 checksum
How to use checksums
b44b0438abc92d6936883ebebf15328bb9b6e45013614dd62d86550ec5b0c3ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Security for okiff-sdk 1.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page