diff --git a/client/src/SignalFirebase.ts b/client/src/SignalFirebase.ts index 72e378c..5266a64 100644 --- a/client/src/SignalFirebase.ts +++ b/client/src/SignalFirebase.ts @@ -1,4 +1,4 @@ -import { getDatabase, onValue, ref, set, remove } from "firebase/database"; +import { getDatabase, onValue, ref, set, remove, goOffline } from "firebase/database"; // import "firebase-config"; import { v4 as uuid } from "uuid"; @@ -53,6 +53,7 @@ export async function signalAccount(offer: string): Promise { + set(peer, offer); return new Promise((resolve, reject) => { @@ -63,6 +64,8 @@ export async function signalAccount(offer: string): Promise { if (data && data.answer && data.candidates) { remove(peer); resolve(data); + goOffline(db); + } } }); diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 6afeab2..0a79b00 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -40,6 +40,7 @@ import logo from "./logo.png"; import AccountCreation from "./AccountCreation.svelte"; import { SnackbarIn } from "m3-svelte/package/containers/Snackbar.svelte"; + import { goOffline } from "firebase/database"; enum ReadyState { Idle, @@ -108,7 +109,7 @@ async function initFirebase() { if (!chosenTracker) return; let tracker = TrackerList[chosenTracker]; - initializeApp(tracker.firebase); + let app = initializeApp(tracker.firebase); } async function connectAccount() {