syntax = "proto3";
package proto;
option go_package = "./messaging/proto";

message Message {
    // type is the type of the message, it is used to determine how to decode the message.
    int32 type = 1;
    // from is the sender of the message.
    string from = 2;
    // to is the receiver of the message.
    string to = 3;
    // topic is the destination of the message, it is used to route the message to the correct handler.
    string topic = 4;
    // payload is the payload of the message.
    repeated bytes payload = 5;
}

service MessageService {
    // Bidirectional streaming RPC for both events and commands
    rpc streamMessages(stream Message) returns (stream Message);
}