Package: pyrtma
pyrtmaRTMA/Dragonfly client written in python with no external dependencies. Based on and compatible withDragonfly MessagingInstallationpyrtma isavailable on PyPIpipinstallpyrtma--upgradeInstalling for pyrtma developmentThis is only necessary for individuals who would like to contribute to pyrtma.From pyrtma git repo directory:pipinstall--upgradepipsetuptools
pipinstall-e.UsageLaunch Managerpython-mpyrtma.managerormessage_managerCreate a message in message.yamlMessage definitions are created in a .yaml file.The ruamel.yaml parser library is used internally (https://yaml.readthedocs.io/en/latest/)Notes about yaml format:Whitespace sensitive. Use either 2 or 4 spaces for tab not '\t'Key-values must be separated by a colon followed by a space, (Key: Value, not Key:Value)Must follow the top-level headers shown below.Unused sections should be markednullNames must start with letter. (no _ or numeric prefixes allowed)Use(.yaml)extension not(.yml)List of supported native data types:charbytefloatdoubleint8int16int32int64uint8uint16uint32uint64Below is an example:# message.yamlimports:null# Constant values and expressionsconstants:STR_SIZE:32LONG_STRING:STR_SIZE * 2# Constant string valuesstring_constants:default_msg:"hello_world"host_ids:nullmodule_ids:PERSON_PUBLISHER:212PERSON_SUBSCRIBER:214# Alias a type by another namealiases:AGE_TYPE:int32# Non-message structured data (no id field)struct_defs:TEST_STRUCT:fields:value_str:char[STR_SIZE]value_int:int32# Message defintions with user assigned id fieldmessage_defs:PERSON_MESSAGE:id:1234fields:name:char[STR_SIZE]age:AGE_TYPEANOTHER_EXAMPLE:id:5678fields:value_struct:TEST_STRUCTvalue_float:floatvalue_double:double# Example signal definitionUSER_SIGNAL:id:2468fields:null# Example using a nested message defintionPERSON_LIST:id:1357fields:person:PERSON_MESSAGE[32]# Example reusing a message definition by another nameEMPLOYEES:id:1368fields:PERSON_LIST# A block of message ids can be reserved by a file for future use# Ranges are inclusive on both ends# Note that ':' cannot be used to indicate a range, as this will cause# the yaml parser to throw an error_RESERVED_:id:[1000,1002 - 1008,1009 to 1012]Run the following command to compile the yaml file into Python, C, Matlab, or Javascript files. This will output a message.(py|h|m|js) file.python-mpyrtma.compile-iexamples/msg_defs/message.yaml--py--c--mat--jsorrtma_compiler-iexamples/msg_defs/message.yaml--py--c--mat--jsThe msg_defs directory should now have message def files created for each language.The rtma objects are compiled into objects suitable for each language.ExamplesSee/examples/example.pyfor pub/sub demo appCompile the example message defintions:python-mpyrtma.compile-i./examples/msg_defs/message.yaml--pyStart the demo MessageManager serverpython-mpyrtma.managerStart the publisher in one console:python./examples/example.py--pubStart the subscriber in another:python./examples/example.py--subJavascriptClients in javascript require the web_manager server to convert websocket messages to rtma messages.Run:python-mpyrtma.web_manager-m<MM_IP>-p<WEBSOCKET_PORT>-d<DEFS_FILE>orweb_manager-m<MM_IP>-p<WEBSOCKET_PORT>-d<DEFS_FILE>to launch the web_manager which will listen to websocket connects on port <WEBSOCKET_PORT> and forward to message manager at <MM_IP>, using pyrtma message definitions defined in <DEFS_FILE>.Seertma-jsfor developing rtma clients in javascript.