Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit a43cd61

Browse files
committed
ensure socket is open before sending event message
1 parent 8427329 commit a43cd61

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ let streamAudioToWebSocket = function (userMediaStream) {
6666
micStream.on('data', function(rawAudioChunk) {
6767
// the audio stream is raw audio bytes. Transcribe expects PCM with additional metadata, encoded as binary
6868
let binary = convertAudioToBinaryMessage(rawAudioChunk);
69-
socket.send(binary);
69+
70+
if (socket.OPEN)
71+
socket.send(binary);
7072
}
7173
)};
7274

0 commit comments

Comments
 (0)