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

Commit e2bde08

Browse files
authored
Merge pull request #24 from yehuda-elementryx/master
Fix bug in issue #23. Fix check ensuring socket is open before sendin…
2 parents 7622210 + ebbdd11 commit e2bde08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ let streamAudioToWebSocket = function (userMediaStream) {
6767
// the audio stream is raw audio bytes. Transcribe expects PCM with additional metadata, encoded as binary
6868
let binary = convertAudioToBinaryMessage(rawAudioChunk);
6969

70-
if (socket.OPEN)
70+
if (socket.readyState === socket.OPEN)
7171
socket.send(binary);
7272
}
7373
)};
@@ -148,7 +148,7 @@ let handleEventStreamMessage = function (messageJson) {
148148
}
149149

150150
let closeSocket = function () {
151-
if (socket.OPEN) {
151+
if (socket.readyState === socket.OPEN) {
152152
micStream.stop();
153153

154154
// Send an empty frame so that Transcribe initiates a closure of the WebSocket after submitting all transcripts

0 commit comments

Comments
 (0)