railway_ipc v0.3.2 RailwayIpc.Core.MessageFormat.JsonProtobuf

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

Messages that use the JsonProtobuf 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 uses colon notation instead of dots

  • The encoded_message attribute is the protobuf in map form

  • 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 the given protobuf by creating a JSON string with two attributes

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 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 Protobuf converted to a map