feat: v2 Phase 1 — foundation, proto schemas, RPC framework, SDK skeleton
New workspace structure with 9 crates. Adds: - proto/qpq/v1/*.proto: 11 protobuf schemas covering all 33 RPC methods - quicproquo-proto: dual codegen (capnp legacy + prost v2) - quicproquo-rpc: QUIC RPC framework (framing, server, client, middleware) - quicproquo-sdk: client SDK (QpqClient, events, conversation store) - quicproquo-server/domain/: protocol-agnostic domain types and services - justfile: build commands Wire format: [method_id:u16][req_id:u32][len:u32][protobuf] per QUIC stream. All 151 existing tests pass. Backward compatible with v1 capnp code.
This commit is contained in:
56
crates/quicproquo-sdk/src/events.rs
Normal file
56
crates/quicproquo-sdk/src/events.rs
Normal file
@@ -0,0 +1,56 @@
|
||||
//! Client event system — real-time notifications from the SDK.
|
||||
|
||||
/// Events emitted by the SDK to the UI layer.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ClientEvent {
|
||||
/// Successfully connected to the server.
|
||||
Connected,
|
||||
|
||||
/// Disconnected from the server.
|
||||
Disconnected { reason: String },
|
||||
|
||||
/// Authentication succeeded.
|
||||
Authenticated { username: String },
|
||||
|
||||
/// A new message was received in a conversation.
|
||||
MessageReceived {
|
||||
conversation_id: [u8; 16],
|
||||
sender_key: Vec<u8>,
|
||||
sender_name: Option<String>,
|
||||
body: String,
|
||||
timestamp_ms: u64,
|
||||
},
|
||||
|
||||
/// A message was sent successfully.
|
||||
MessageSent {
|
||||
conversation_id: [u8; 16],
|
||||
seq: u64,
|
||||
},
|
||||
|
||||
/// A new conversation was created or discovered.
|
||||
ConversationCreated {
|
||||
conversation_id: [u8; 16],
|
||||
display_name: String,
|
||||
},
|
||||
|
||||
/// A member was added to a group conversation.
|
||||
MemberAdded {
|
||||
conversation_id: [u8; 16],
|
||||
member_key: Vec<u8>,
|
||||
},
|
||||
|
||||
/// A member was removed from a group conversation.
|
||||
MemberRemoved {
|
||||
conversation_id: [u8; 16],
|
||||
member_key: Vec<u8>,
|
||||
},
|
||||
|
||||
/// Server-push event received.
|
||||
PushEvent {
|
||||
event_type: u16,
|
||||
payload: Vec<u8>,
|
||||
},
|
||||
|
||||
/// An error occurred in the background.
|
||||
Error { message: String },
|
||||
}
|
||||
Reference in New Issue
Block a user