Commit dbc244aa authored by Marco Boers's avatar Marco Boers

Restart stream on error

parent 681002aa
......@@ -44,7 +44,11 @@ wss.on('connection', (webs) => {
function createDetectStream() {
detectStream = sessionClient
.streamingDetectIntent()
.on('error', console.error)
.on('error', (err) => {
detectStream.end();
detectStream = null;
createDetectStream();
})
.on('data', data => {
console.log(data.query_result);
if (data.recognitionResult) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment