From 8c50b26b7107dd82af16c8df3eed2504b2a4af9c Mon Sep 17 00:00:00 2001 From: mathieu Date: Fri, 2 Dec 2022 15:45:01 +0100 Subject: [PATCH] websockets stuff --- .../main/java/ch/broillet/jarvis/android/pages/MainPage.kt | 6 +++--- .../java/ch/broillet/jarvis/android/utils/SocketHandler.kt | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/ch/broillet/jarvis/android/pages/MainPage.kt b/app/src/main/java/ch/broillet/jarvis/android/pages/MainPage.kt index 91649e4..72b3db9 100644 --- a/app/src/main/java/ch/broillet/jarvis/android/pages/MainPage.kt +++ b/app/src/main/java/ch/broillet/jarvis/android/pages/MainPage.kt @@ -177,11 +177,11 @@ fun DisplayMainPage( SocketHandler.processMessage("test", MainActivity().uniqueID) thread { - //val requestOutput = getTextFromAudio(audioRecorder.getOutputFile()) + val requestOutput = getTextFromAudio(audioRecorder.getOutputFile()) - val temp = JSONObject() + /*val temp = JSONObject() temp.put("data", "salut je suis bob") - val requestOutput = temp.toString() + val requestOutput = temp.toString()*/ processing = false diff --git a/app/src/main/java/ch/broillet/jarvis/android/utils/SocketHandler.kt b/app/src/main/java/ch/broillet/jarvis/android/utils/SocketHandler.kt index 94a8a76..f88cd4f 100644 --- a/app/src/main/java/ch/broillet/jarvis/android/utils/SocketHandler.kt +++ b/app/src/main/java/ch/broillet/jarvis/android/utils/SocketHandler.kt @@ -37,11 +37,13 @@ object SocketHandler { val body = JSONObject() body.put("data", message) body.put("uuid", uuid) - getSocket().emit("process_message", body) + getSocket().emit("process_message", body.toString()) } @Synchronized fun joinRoom(uuid: String) { - getSocket().emit("join", uuid) + val body = JSONObject() + body.put("uuid", uuid) + getSocket().emit("join", body.toString()) } } \ No newline at end of file