             print('CLOSE');
                        ws = null;
                    }
                    ws.onmessage = function (evt) {
                        data = JSON.parse(evt.data);
                        if (!data.serverContent) return;
                        if (data.serverContent.turnComplete) {
                            if (audioChunksSent.length > 0) {
                                console.log(audioChunksSent.length);
                                printChatAudio(encodeAudio(audioChunks