diff --git a/src/client/main.js b/src/client/main.js
index 64a97c8..1b9c944 100644
--- a/src/client/main.js
+++ b/src/client/main.js
@@ -5,12 +5,40 @@ function startGame(){
let mainfield = $("#mainfield");
mainfield.html('
');
-
-
}
-function refresh(){
+const socket = new WebSocket('ws://192.168.178.24:3001');
+socket.addEventListener('open', (event) => {
+ console.log('WebSocket-Verbindung hergestellt');
+});
+
+socket.addEventListener('message', (event) => {
+ const messageDiv = document.getElementById('message');
+ messageDiv.innerHTML = `${event.data}`;
+
+});
-}
\ No newline at end of file
+socket.addEventListener('close', (event) => {
+ console.log('WebSocket-Verbindung getrennt');
+});
+
+
+// Funktion zum Vorlesen der Nachricht
+function speakMessage() {
+ // Verwenden Sie die SpeechSynthesis-API, um die Nachricht vorzulesen
+
+ let text = $('#message').html();
+
+
+ const synth = window.speechSynthesis;
+ const utterance = new SpeechSynthesisUtterance(text);
+ synth.speak(utterance);
+ utterance.onend = function (){
+ console.log("funktioniert");
+ }
+ utterance.onerror= function (){
+ alert("fehlschlag");
+ }
+}