Files

NixMsg Python SDK

包名 nixmsg,最低 Python 3.10。同步接口为主,AsyncClient 提供 asyncio 包装。

安装

pip install nixmsg --index-url https://git.asio.asia/api/packages/nixevol/pypi/simple/

最小示例

from nixmsg import Client, Target, Body

c = Client()
c.on_session(lambda token: print("session", token))
c.on_message(lambda msg: print("msg", msg.id, msg.body.data))
c.connect("ws://127.0.0.1:7443/mqtt", "device-1", password="secret")
c.send(Target(kind="endpoint", id="device-2"), Body(data="hello"))
c.close()

许可证见 LICENSE(专有)。