railway_ipc v0.3.2 RailwayIpc.Core.MessageFormat.BinaryProtobuf

This is an internal module, not part of the public API.

Messages that use the BinaryProtobuf format have the following characteristics:

  • The payload s a struct that contains two attributes: type and encoded_message

  • The type attribute is the name of the Elixir module for the protobuf without the "Elixir" prefix and to use colon notation instead of dots.

  • The encoded_message attribute is the encoded protobuf which is then Base64 encoded to make it friendly to JSON conversion.

  • The entire payload is then converted to JSON.

Note: I think the reason for converting to colon notation is an artifact of wanting to be compatable with the Ruby version since Ruby classes use colon notation. -BN

Link to this section Summary

Functions

Decodes the given message into a Protobuf struct.

Encodes protobuf in message format. Returns the encoded protobuf and the message type as a string in colon format.

Link to this section Functions

Link to this function

decode(message)

Decodes the given message into a Protobuf struct.

Link to this function

encode(protobuf)

Encodes protobuf in message format. Returns the encoded protobuf and the message type as a string in colon format.

Encodes the given protobuf by creating a JSON string with two attributes:

  • type -- the Protobuf module name as a string using colon notation
  • encoded_message -- the Base64 encoded Protobuf