Add chat functionality between technician and client

- Add ChatMessage to protobuf definitions
- Server relays chat messages between agent and viewer
- Agent chat module shows messages via MessageBox
- Dashboard chat modal with WebSocket connection
- Simplified protobuf encoder/decoder in JavaScript

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-28 16:31:16 -07:00
parent 0dcbae69a0
commit aa03a87c7c
6 changed files with 694 additions and 9 deletions

View File

@@ -161,9 +161,17 @@ async fn handle_agent_connection(
// Try to decode as protobuf message
match proto::Message::decode(data.as_ref()) {
Ok(proto_msg) => {
if let Some(proto::message::Payload::VideoFrame(_)) = &proto_msg.payload {
// Broadcast frame to all viewers
let _ = frame_tx.send(data.to_vec());
match &proto_msg.payload {
Some(proto::message::Payload::VideoFrame(_)) => {
// Broadcast frame to all viewers
let _ = frame_tx.send(data.to_vec());
}
Some(proto::message::Payload::ChatMessage(chat)) => {
// Broadcast chat message to all viewers
info!("Chat from client: {}", chat.content);
let _ = frame_tx.send(data.to_vec());
}
_ => {}
}
}
Err(e) => {
@@ -255,6 +263,11 @@ async fn handle_viewer_connection(
// Forward input to agent
let _ = input_tx.send(data.to_vec()).await;
}
Some(proto::message::Payload::ChatMessage(chat)) => {
// Forward chat message to agent
info!("Chat from technician: {}", chat.content);
let _ = input_tx.send(data.to_vec()).await;
}
_ => {}
}
}