mirror of
https://github.com/openai/codex.git
synced 2026-05-04 03:16:31 +00:00
Add WebRTC support to realtime test server
Teach the shared test helper to accept realtime /calls POSTs, answer SDP offers, and relay scripted events over a data channel while logging incoming RTP audio packets as synthetic append requests. Update the one stale handshake-path assertion to the /realtime/calls URL. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -37,6 +37,8 @@ use wiremock::matchers::path_regex;
|
||||
|
||||
use crate::test_codex::ApplyPatchModelOutput;
|
||||
|
||||
mod realtime_webrtc_server;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseMock {
|
||||
requests: Arc<Mutex<Vec<ResponsesRequest>>>,
|
||||
@@ -1238,6 +1240,29 @@ pub async fn start_websocket_server_with_headers(
|
||||
tokio::time::sleep(delay).await;
|
||||
}
|
||||
|
||||
if realtime_webrtc_server::accept_is_http_post(&stream).await {
|
||||
let connection_index = {
|
||||
let mut log = requests.lock().unwrap();
|
||||
log.push(Vec::new());
|
||||
log.len() - 1
|
||||
};
|
||||
realtime_webrtc_server::serve_connection(
|
||||
stream,
|
||||
connection,
|
||||
connection_index,
|
||||
Arc::clone(&requests),
|
||||
Arc::clone(&handshakes),
|
||||
Arc::clone(&request_log),
|
||||
start,
|
||||
)
|
||||
.await;
|
||||
|
||||
if connections.lock().unwrap().is_empty() {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
let response_headers = connection.response_headers.clone();
|
||||
let handshake_log = Arc::clone(&handshakes);
|
||||
let callback = move |req: &Request, mut response: Response| {
|
||||
|
||||
Reference in New Issue
Block a user