const ws = new WebSocketClient();
ws.on('connectFailed', (err) => {
console.error('Connection Failed.', err);
});
ws.on('connect', (connection) => {
micInstance.start();
connection.on('close', () => {
console.log('WebSocket closed.')
});
connection.on('error', (err) => {
console.log('WebSocket error.', err)
});
connection.on('message', (data) => {
if (data.type === 'utf8') {
const {
utf8Data
} = data;
console.log(utf8Data);
}
});
console.log('Connection established.');
connection.send(JSON.stringify({
"type": "start_request",
"insightTypes": ["question", "action_item"],
"config": {
"confidenceThreshold": 0.9,
"languageCode": "en-US",
"speechRecognition": {
"encoding": "LINEAR16",
"sampleRateHertz": 44100
},
"meetingTitle": "Client Meeting"
},
"speaker": {
"userId": "jane.doe@example.com",
"name": "Jane"
}
}));
micInputStream.on('data', (data) => {
connection.send(data);
});
});