services/speech_to_text/v1.js
function processInputStream(msg) {
      var tmp = msg.payload;

      if ('string' === typeof msg.payload) {
        msg.payload = JSON.parse(tmp);
      }
      if (msg.payload.action) {
        if ('start' === msg.payload.action) {
          startPacket = msg.payload;
        }
      } else {
        msg.payload = { 'action' : 'data', 'data' : tmp };
      }

      return Promise.resolve(msg.payload);
    }
function processInputStream(msg) {
      var tmp = msg.payload;

      if ('string' === typeof msg.payload) {
        msg.payload = JSON.parse(tmp);
      }
      if (msg.payload.action) {
        if ('start' === msg.payload.action) {
          startPacket = msg.payload;
        }
      } else {
        msg.payload = { 'action' : 'data', 'data' : tmp };
      }

      return Promise.resolve(msg.payload);
    }
function processInputStream ( msg ) { var tmp = msg . payload ; if ( 'string' === typeof msg . payload ) { msg . payload = JSON . parse ( tmp ) ; } if ( msg . payload . action ) { if ( 'start' === msg . payload . action ) { startPacket = msg . payload ; } } else { msg . payload = { 'action' : 'data' , 'data' : tmp } ; } return Promise . resolve ( msg . payload ) ; }
The input is from a websocket stream in Node-RED. expect action of 'start' or 'stop' or a data blob if its a blob then its going to be audio.
The input is from a websocket stream in Node - RED . expect action of start or stop or a data blob if its a blob then its going to be audio .