Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const main = async () => {
try {
const speech = await connectToSpeechd({ autoSpawn: !autoSpawn });
const broker = createWebSocket();
log("Connected to WebSocket");
broker.subscribe(new RegExp("speech/.*"), handleMessage(speech, broker));
speech.speak("Hello");
} catch (e) {
console.log("Error:", e);
}
};
const webSocket = ({ host, downloader }) => {
const ws = createWebsocket();
const callback = sendMessage(ws);
const handler = handleMessage({ host, downloader, callback });
ws.subscribe(subscribedTopic, handler);
};