collabvm3-protocol/src/server.proto
2025-01-10 14:14:41 -05:00

96 lines
2.1 KiB
Protocol Buffer

//! Declares "ServerMessage", the super-message the server sends to clients.
edition = "2023";
package collabvm.protocol;
option csharp_namespace = "CollabVM.Protocol";
import "user.proto";
import "admin.proto";
import "vm.proto";
import "vote.proto";
import "remoting.proto";
message ServerMessage {
message ServerHello {
/// The protocol version.
uint32 protocol_version_major = 1;
uint32 protocol_version_minor = 2;
// server version?
}
message ServerInit {
// The client's username
string username = 1;
user.UserList user_list = 2;
vm.ChatHistory chat_history = 3;
string motd = 4;
uint32 max_chat_length = 5;
uint32 rank = 6;
remoting.KeyboardLEDState keyboard_led_state = 7;
}
message Disconnect {
/// Optional reason.
string reason = 1;
}
message ScreenshotResponse {
/// Screenshot data as WebP. (This is the same format regardless of display format.)
bytes screenshot_data = 1;
}
/// Keepalive message.
message Keepalive {}
/// Rate limited
message RateLimited {
/// The action that was rate limited.
string action = 1;
/// Milliseconds until the client may perform the action again.
uint32 limit_time = 2;
}
message Muted {
/// Duration of the mute in milliseconds.
uint32 duration = 1;
}
message Unmuted {}
oneof Union {
ServerHello hello = 1;
ServerInit init = 2;
remoting.RemotingServerMessage remoting_message = 3;
admin.AdminServerMessage admin_message = 4;
Disconnect disconnect = 5;
// user stuff
// user.UserList user_list = 6;
user.UserJoined add_user = 7;
user.UserLeft remove_user = 8;
// VM turn
vm.TurnQueue turn_queue = 10;
// VM chat
vm.ChatMessage chat_message = 11;
vm.ChatHistory chat_history = 12;
vm.SystemChatMessage system_chat_message = 13;
// vote messages
vote.VoteInformation vote_information = 14;
vote.VoteTally vote_tally = 15;
vote.VoteEnded vote_ended = 16;
vote.VoteStartFailure vote_start_failure = 17;
ScreenshotResponse screenshot_response = 18;
Keepalive keepalive = 19;
RateLimited rate_limited = 20;
Muted muted = 21;
Unmuted unmuted = 22;
}
}