Skip to content

Commit 775e6d2

Browse files
committed
fix: query parameters no longer cause text-to-speech over websockets to crash
1 parent ab4c1cb commit 775e6d2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

examples/text_to_speech_websocket.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ const synthesizeStream = textToSpeech.synthesizeUsingWebSocket(params);
2222
// the output of the stream can be piped to any writable stream, like an audio file
2323
synthesizeStream.pipe(fs.createWriteStream('./speech.ogg'));
2424

25+
// !!!!! IMPORTANT !!!!!
2526
// if the stream is not being piped anywhere and is only being listened to, the stream needs
26-
// to be explicitly set to flowing mode:
27+
// to be explicitly set to flowing mode by uncommenting the following line:
2728

2829
// synthesizeStream.resume();
2930

lib/synthesize-stream.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class SynthesizeStream extends Readable {
9999
const url =
100100
(options.url || 'wss://stream.watsonplatform.net/text-to-speech/api')
101101
.replace(/^http/, 'ws') +
102-
'/v1/synthesize' +
102+
'/v1/synthesize?' +
103103
queryString;
104104

105105
const socket = (this.socket = new w3cWebSocket(

0 commit comments

Comments
 (0)