Skip to main content

WebSocket server for republishing LCM messages

Project description

lcm-websocket-server

WebSocket server for republishing LCM messages.

Installation

You must have the LCM Python package installed before using lcm-websocket-server. See the LCM build instructions for more information.

From PyPI

pip install lcm-websocket-server

From source

poetry build
pip install dist/lcm_websocket_server-*-py3-none-any.whl

Usage

For a list of available options, run:

lcm-websocket-server --help

To run the server locally on port 8765 and republish messages on all channels:

lcm-websocket-server --host localhost --port 8765 --channel ".*" your_lcm_types_package

The lcm_packages argument is the name of the package (or comma-separated list of packages) that contains the LCM Python message definitions. Submodules are scanned recursively and registered so they can be automatically identified, decoded, and republished.

Example: compas_lcmtypes

For example, the compas_lcmtypes package contains LCM types for the CoMPAS lab. These can be installed with:

pip install compas-lcmtypes==0.1.0

Then, the server can be run with:

lcm-websocket-server compas_lcmtypes

Docker

Build

A Docker image to run the lcm-websocket-server can be built with:

./scripts/docker_build.sh

This will create the mbari/lcm-websocket-server image.

Run

The container can be run with:

docker run \
    --name lcm-websocket-server \
    --rm \
    -e HOST=0.0.0.0 \
    -e PORT=8765 \
    -e CHANNEL=".*" \
    -v /path/to/your_lcm_types_package:/app/your_lcm_types_package \
    -e LCM_PACKAGES=your_lcm_types_package \
    --network=host \
    -d \
    mbari/lcm-websocket-server

Note that the HOST, PORT, and CHANNEL environment variables specified above are the defaults for the mbari/lcm-websocket-server image. These can be omitted if the defaults are acceptable.

The LCM_PACKAGES environment variable should be set to the name of the package (or comma-separated list of packages) that contains the LCM Python message definitions. The /app directory is included in the PYTHONPATH so that any packages mounted there (as shown with -v above) can be imported.

It's recommended to run with --network=host to avoid issues with LCM over UDP. This will allow the container to use the host's network stack.

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 Distribution

lcm_websocket_server-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file lcm_websocket_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lcm_websocket_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03575c7ee49b5ad5b8df81f3d4ccf370668b471aa953b100994e1d9703aa96c8
MD5 61ca4d5eb975a00eb812623e06962448
BLAKE2b-256 8ef49c9a7d62e740f43d97cea24e8540f3555a8e56214e6ae53943cd03e9b3ca

See more details on using hashes here.

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