syntax = “proto3”;

package anycable;

service RPC {

rpc Connect (ConnectionRequest) returns (ConnectionResponse) {}
rpc Command (CommandMessage) returns (CommandResponse) {}
rpc Disconnect (DisconnectRequest) returns (DisconnectResponse) {}

}

enum Status {

ERROR = 0;
SUCCESS = 1;
FAILURE = 2;

}

message Env {

string url = 1;
map<string,string> headers = 2;
map<string,string> cstate = 3;
map<string,string> istate = 4;

}

message EnvResponse {

map<string,string> cstate = 1;
map<string,string> istate = 2;

}

message ConnectionRequest {

Env env = 3;

}

message ConnectionResponse {

Status status = 1;
string identifiers = 2;
repeated string transmissions = 3;
string error_msg = 4;
EnvResponse env = 5;

}

message CommandMessage {

string command = 1;
string identifier = 2;
string connection_identifiers = 3;
string data = 4;
Env env = 5;

}

message CommandResponse {

Status status = 1;
bool disconnect = 2;
bool stop_streams = 3;
repeated string streams = 4;
repeated string transmissions = 5;
string error_msg = 6;
EnvResponse env = 7;
repeated string stopped_streams = 8;

}

message DisconnectRequest {

string identifiers = 1;
repeated string subscriptions = 2;
Env env = 5;

}

message DisconnectResponse {

Status status = 1;
string error_msg = 2;

}