Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate commands/events into payload to enable more generic message passing #3

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions proto/relay.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,35 @@ import "self_serve/orb.proto";

// Service Definitions
service OrbService {
rpc OrbConnect(stream OrbEvent) returns (stream OrbCommand);
rpc OrbConnect(stream RelayMessage) returns (stream RelayMessage);
}

service AppService {
rpc AppConnect(stream AppEvent) returns (stream AppCommand);
rpc AppConnect(stream RelayMessage) returns (stream RelayMessage);
}

service BackendService {
rpc RequestOrbUpdateConfig(config.OrbUpdateConfigRequest) returns (config.OrbUpdateConfigResponse);
}

message RelayPayload {
oneof payload {
OrbConnectRequestEvent orb_connect_request_event = 1;
AppConnectRequestEvent app_connect_request_event = 2;
OrbCommand orb_command = 3;
OrbEvent orb_event = 4;
AppCommand app_command = 5;
AppEvent app_event = 6;
BackendEvent backend_event = 7;
BackendCommand backend_command = 8;
}
}

message RelayMessage {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to have an optional origin string too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely could make sense. I'll hold off on adding until we see a viable use case for it. Easy to add :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually... Don't we need it even now? Imagine self serve flow scenario. App sends message to Orb. Orb needs to know where to respond.

Our self serve integration tests rely on having both clients know each other app_id and orb_id - that's just how we wrote tests.

In real life scenario, app or orb that receive message, will not know the sender - we should add it now.

string destination = 1;
RelayPayload payload = 2;
}

message OrbConnectRequestEvent {
string orb_id = 1;
string auth_token = 2;
Expand Down
8 changes: 2 additions & 6 deletions proto/self_serve/app.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ message AppReceiveQRCommand {
string qr_code = 1;
}

message AppConnectedToOrbCommand {
string orb_id = 1;
}
message AppConnectedToOrbCommand {}

message AppShowStartSignupButtonCommand {}

Expand All @@ -20,6 +18,4 @@ message AppReceiveSignupResultCommand {

message AppRequestStartSelfServeFlowEvent {}

message AppRequestStartSignupEvent {
string orb_id = 1;
}
message AppRequestStartSignupEvent {}
11 changes: 3 additions & 8 deletions proto/self_serve/orb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ package selfserve;

message OrbStartSelfServeSignupCommand {}

message OrbSelfServeSessionStartedEvent {
string app_id = 1;
}
message OrbSelfServeSessionStartedEvent {}

message OrbSignupStartedEvent {
string app_id = 1;
}
message OrbSignupStartedEvent {}

message OrbSignupCompletedEvent {
string app_id = 1;
bool success = 2;
bool success = 1;
}
Loading