Skip to main content

Message Exchange protocol.

Project description

MsgX: Message eXchange

This repository is MsgX, a message exchange interface to send binary data between languages, e.g., from C++ to Python. This is achived by serialising and deserialising native binary representation from some common interface.

This can be used as a publisher and subscriber model between C++ and Python, and a stateful model in the Jupyter notebook ecosystem that captures the incoming message. It supports asynchronous refresh within the notebook whenever a new message is published from your C++ files, and automatically display them within the notebook. This library also support non-notebook usage where it uses MsgX's native figure display from within your browser.

Requirements

  • zeromq (messaging protocol)

  • capnproto (serialisation of message)

Using the library in your C++ project

You can include the project it as you normally. The following shows a snippet to quickly visualise your code using MsgX without much setup

Quick and dirty out-of-tree build in cmake

In your CMakeLists.txt:

cmake_minimum_required(...)

...

# Add as out-of-tree build (with absolute path & binary directory)
add_subdirectory(
        /home/soraxas/git-repo/msgx
        msgx
)
find_package( msgx REQUIRED )

...

# link the library to your target
target_link_libraries( ${MY_TARGET} msgx )

Example Usage

Say you have something like this in your ${MY_TARGET}

#include "msgx/message.h"

using namespace msgx::kwargs;

int main(int argc, char const *argv[]) {
    msgx::MessageX msg;
    std::vector<double> x{5, 2, 0, 4, 4, 6, 7};
    std::vector<double> y{1, 2, 3, 2, 3, 4, 5};

    msg = msg.Mapping("xs"_kw = x, "ys"_kw = y);
    msg.send();
}

From python:

>>> from msgx import spin_default
>>> spin_default()

# msg.send(); in c++

{'ys': array([1., 2., 3., 2., 3., 4., 5.]), 'xs': array([5., 2., 0., 4., 4., 6., 7.])}

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

msgx-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

msgx-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file msgx-1.0.0.tar.gz.

File metadata

  • Download URL: msgx-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for msgx-1.0.0.tar.gz
Algorithm Hash digest
SHA256 80d99076958959bf33f036157ddec35dfe3004b9a6b67df21a771f755fb4e054
MD5 9c2192d83019a4d8449e37d0ab2c8ab0
BLAKE2b-256 c7b6077d039be7993048f2700e9c25ec5d53cd5ed34da889d4a446759a196c47

See more details on using hashes here.

File details

Details for the file msgx-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: msgx-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for msgx-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca90bfada4331b455fcfc22cf6273dca406cf11d143800c10a80f0949d8b02d
MD5 53ba48561b37c8aa2211c43ac1593356
BLAKE2b-256 d56b33496cc3dcc89dd8c5d216cf60e78c3ade096c4da9a1b4382062567fd135

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