express setup (mfw 40s connect time)

This commit is contained in:
Spencer Pogorzelski 2023-08-10 19:52:20 -07:00
parent d736ec6653
commit 4a12337f77
4 changed files with 318 additions and 28 deletions

View file

@ -29,6 +29,18 @@ export default class App extends Component {
console.log("offer created", offer);
console.log(JSON.stringify(offer));
const r = await fetch("http://localhost:3000/connect", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(offer),
});
if (r.status != 200) {
throw new Error("connect: " + r.status + " " + r.statusText);
}
const { answer, candidates } = await r.json();
await this.rtc.answer(answer, candidates);
alert("connected");
// setOffer(JSON.stringify(offer));
// this.setState(prev => ({ ...prev, offer: JSON.stringify(offer) }));