Skip to main content

Okiff SDK

Project description

okiff-sdk

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


Requirements

  • Python 3.9 or later
  • Linux x86-64 (glibc ≥ 2.39), with additional platforms coming

Installation

pip install okiff-sdk

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


Quick Start

"""
Example:
    Basic publish/subscribe usage of the okiff-sdk.
"""


# Imports
import time
from okiff_sdk import SDK


# Client setup
sdk = SDK()


# Callbacks
def on_connection(connected: bool, rc: int) -> None:
    """
    Handle connection state changes.

    Args:
        connected: True if connected, False if disconnected.
        rc: Paho return code. 0 = clean, -1 = unexpected loss.
    """

    print(f"[on_connection] connected={connected}, rc={rc}")


def on_message(topic: str, payload: str) -> None:
    """
    Handle incoming messages.

    Args:
        topic: Topic on which the message was received.
        payload: Message body as a UTF-8 string.
    """

    print(f"[on_message] topic={topic}, payload={payload}")


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


# Initialize and connect
sdk.init(
    client_id   = "my_client",
    broker_host = "broker.example.com:1883",
    protocol    = "tcp",
    username    = "user",
    password    = "password",
)


# Connect
ok = sdk.connect()


# Publish and subscribe
if ok:
    sdk.subscribe("my/topic")
    sdk.publish("my/topic", "hello")
    time.sleep(2)


# Cleanup
sdk.disconnect()
sdk.stop()

API Reference

SDK()

Creates a new SDK instance.

init(client_id, broker_host, protocol, username, password)

Initializes the client. Must be called before connect().

Parameter Type Description
client_id str Unique identifier for this client
broker_host str Broker address including port, e.g. broker.example.com:1883
protocol str Transport protocol: "tcp" or "ssl"
username str Authentication username
password str Authentication password

connect() -> bool

Connects to the broker. Returns True on success.

disconnect()

Gracefully disconnects from the broker.

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

Publishes a message to the given topic.

subscribe(topic, qos=0) -> bool

Subscribes to a topic. Returns True on success.

unsubscribe(topic)

Unsubscribes from a topic.

on_message(callback)

Registers a callback invoked when a message arrives. Signature: callback(topic: str, payload: str) -> None

on_connection(callback)

Registers a callback invoked on connection state changes. Signature: callback(connected: bool, rc: int) -> None

is_connected() -> bool

Returns the current connection state.

stop()

Stops all activity and releases resources. Call after disconnect().


License

Proprietary — all rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

okiff_sdk-1.1.8-cp314-cp314-manylinux_2_39_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

okiff_sdk-1.1.8-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

okiff_sdk-1.1.8-cp313-cp313-manylinux_2_39_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

okiff_sdk-1.1.8-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

okiff_sdk-1.1.8-cp312-cp312-manylinux_2_39_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

okiff_sdk-1.1.8-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file okiff_sdk-1.1.8-cp314-cp314-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for okiff_sdk-1.1.8-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 729924c086154cfccf9d76ada1ee8425029aeac12b76c47157c9025228bdc30f
MD5 5efe08bad73baf5382b0080c362c3cdf
BLAKE2b-256 ea0dd0c5093b2f9dd6874b060cae78cfd4bd2184850abe1284bab2f1a57addda

See more details on using hashes here.

File details

Details for the file okiff_sdk-1.1.8-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for okiff_sdk-1.1.8-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fd11e59d9966e524e6998a69966cc1d82d9a9313f3ae97a2a67b52cdc963a370
MD5 c5fa475cad8e9d652d521cbc290a7e05
BLAKE2b-256 c46e712462d88580c429f8c5e69994de528c62e719e6a81b302217c5d9cf102c

See more details on using hashes here.

File details

Details for the file okiff_sdk-1.1.8-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for okiff_sdk-1.1.8-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 be73a36a51e78fe1374cccd949148953fb42d4153d046d463ba52eb78215ecd5
MD5 97a0dc3ef5817b62c0f74eceb7fe5321
BLAKE2b-256 2e91720a264ec0ea5b012c34c8c164a644fa8ba35aacd40e991d289ee1c1e972

See more details on using hashes here.

File details

Details for the file okiff_sdk-1.1.8-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for okiff_sdk-1.1.8-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 142614de9edc1508db84aed58615786079778e1a963e76a26a8e9d64c8f71c36
MD5 371eac5b5ce05d2a15b5c24aac7a5f01
BLAKE2b-256 f1c2652a355f783fda844e815fa5d457260d5eabee2417b22a606f1673eb2ba7

See more details on using hashes here.

File details

Details for the file okiff_sdk-1.1.8-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for okiff_sdk-1.1.8-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 3ba561f78cd1eb6bf191120f5ea08065794245983095b1ecebb87d9d206436cd
MD5 1081f0bb575470e7ad28648d4f908aaf
BLAKE2b-256 1b983ceb0df8e05b5263693ed45d486f15805e7508919fd9aea9d8676afed884

See more details on using hashes here.

File details

Details for the file okiff_sdk-1.1.8-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for okiff_sdk-1.1.8-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a76eec3412d1fe7b1a2aa43598335f82a262448e690f9ef938a44351bed63678
MD5 fa08529d449189dbb13e25ad881c9b85
BLAKE2b-256 a3dbce59f710b23208ebc7be290c404a3a234770ab9c5cbba3d47332b919b21b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page