- We need to make sure that each message is delivered to client.
- We need to persist it immediately after receiving
- Message will be removed after confirmation from client
Depends on D9314
Differential D9316
[Tunnelbroker] always persist WebSocket messages in database kamil on Sep 28 2023, 7:39 AM. Authored by Tags None Referenced Files
Details
Depends on D9314
#[tokio::test] async fn send_websocket() { let device_info = create_device(None).await; let mut socket = create_socket(&device_info).await; let request = WebsocketMessageToDevice { device_id: device_info.device_id.to_string(), payload: "message from test".to_string(), }; let serialized_request = serde_json::to_string(&request) .expect("Failed to serialize connection request"); println!("request: {}", serialized_request); socket .send(Message::Text(serialized_request)) .await .expect("Failed to send message"); }
2023-09-28T12:52:08.492774Z DEBUG tunnelbroker::websockets::session: Received message for ZXx1ADCFxFm6P+UmVhX0A1tuqUoBU7lYjig/gMzSEJI 2023-09-28T12:52:08.492789Z DEBUG tunnelbroker::database: Persisting message to device: ZXx1ADCFxFm6P+UmVhX0A1tuqUoBU7lYjig/gMzSEJI
cd services/commtest && cargo test --test tunnelbroker_persist_tests -- --nocapture
Diff Detail
Event Timeline
|