File size: 691 Bytes
abc40d6
 
 
 
 
 
 
 
 
 
81af860
abc40d6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
    <title>WebSockets y Reconocimiento de Voz</title>
</head>
<body>
    <div id="output"></div>
    <button onclick="startRecognition()">Comenzar Reconocimiento</button>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"></script>
    <script>
        const socket = io.connect('https://' + document.domain + ':' + location.port);

        socket.on('response', function (message) {
            const output = document.getElementById('output');
            output.innerHTML = message;
        });

        function startRecognition() {
            socket.emit('recognize_speech');
        }
    </script>
</body>
</html>