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_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.2

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.2
File Actions
okiff_sdk-1.2.2-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.2-cp314-cp314-manylinux_2_39_x86_64.whl
okiff_sdk-1.2.2-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.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
okiff_sdk-1.2.2-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.2-cp313-cp313-manylinux_2_39_x86_64.whl
okiff_sdk-1.2.2-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.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
okiff_sdk-1.2.2-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.2-cp312-cp312-manylinux_2_39_x86_64.whl
okiff_sdk-1.2.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for okiff_sdk-1.2.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Total release size: 11.3 MB

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

Download URL okiff_sdk-1.2.2-cp314-cp314-manylinux_2_39_x86_64.whl
Size 2.2 MB
Tags CPython 3.14 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
264dd88a6adb92a669b217ff01a2746889f5ba0735da717ad06f491dbc47e92e
BLAKE2b-256 checksum
How to use checksums
c505d5afa3777e4dc4a73798ed406b542e8f0767af4c82b26da3588e6eae2480
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.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL okiff_sdk-1.2.2-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.6 MB
Tags CPython 3.14 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
704c2dbd4836e4f1c5339e72df4cd085de8445a1518b65a5c03ba123d6b70757
BLAKE2b-256 checksum
How to use checksums
62d8a3e5e02e3c8dba77a287795a3ceaea05972bec4f16cdc2fc998c019525f8
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.2-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL okiff_sdk-1.2.2-cp313-cp313-manylinux_2_39_x86_64.whl
Size 2.2 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
53d5f618ccc89000d4177c15caf07897f698e79c10a32652cc669d5420411822
BLAKE2b-256 checksum
How to use checksums
336d823f470d74d29f7cbdec72b5237fd55c250240c100d20aebff340c6d6d84
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.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL okiff_sdk-1.2.2-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.6 MB
Tags CPython 3.13 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
20f382960d0b6c01534134f21c6c508f923831e0636dcd079600dae527978aca
BLAKE2b-256 checksum
How to use checksums
fff2ee3cfd68f28a086dd81de2adbcc89433f93774b8d17521ad98257dd2db54
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.2-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL okiff_sdk-1.2.2-cp312-cp312-manylinux_2_39_x86_64.whl
Size 2.2 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
0fd0c7b530bd8e6c77f5c448c73f4ddbb3892ca317bfec6b24a13124688170c3
BLAKE2b-256 checksum
How to use checksums
c10b2d97ee8e710cb02a269c156c093b973038e2695b6091dc7c81be608c7677
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.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL okiff_sdk-1.2.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 1.6 MB
Tags CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
c59d46d6be43bd12041a9656300897abeb509c694a60f2bafa24f51c3ce82b72
BLAKE2b-256 checksum
How to use checksums
aee3d72c31c5ac6b8dd91e526ef265e981c781cbba6196fbbb4800460105d072
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.2

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