Skip to main content

Bridge mqtt <--> websocket

Project description

mqtt-bridge

Bridge mqtt <--> websocket

Docker image:

docker run --network=host registry.gitlab.com/roxautomation/components/mqtt-bridge

Configuration

override these environment variables if desired

  • WS_PORT=9095
  • MQTT_HOST=localhost
  • MQTT_PORT=1883

How it works

  • web ui connects to websocket. It then subscibes to topics or publishes data.
  • messages are forwarded between websocket and mqtt.

Note current implementation is quite simple, there is in distinction between topic subscriptions from clients. All clients will receive all subscriptions.

Protocol

The protocol is subset of rosbridge protocol

  • subscribe {"op":"subscribe", "topic":<string>}"
  • publish {"op":"publish", "topic": <string>, "msg":<json>}

Development

  1. open in VSCode devcontainer, develop.
  2. use invoke to lint, build etc.

Testing

There are a lot of moving parts here (mqtt broker, websockets etc.). It is a lot of work to implement descent tests using pytest for this. Therefore we rely more on integration tests located in integration folder. These tests simulate a system consisting of a bridge and mqtt and ws clients.

Tooling

  • Verisoning : bump2version
  • Linting and formatting : ruff
  • Typechecking: mypy

What goes where

  • src/rox_bridge app code. pip install . .
  • docker folder contains dockerfiles for images.
  • .gitlab-ci.yml takes care of the building steps.

Project details


Download files

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

Source Distribution

rox_bridge-1.2.0.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

rox_bridge-1.2.0-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

Supported by

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