cont3xt/vueapp/src/components/services/Cont3xtService.js
/**
   * Parses JSON and sends the chunk to the subscriber.
   * Also sends any errors to the subscriber.
   * Logs JSON parsing errors to the console with the offending JSON.
   * @param {Object} subscriber - The subscriber to send chunks
   * @param {String} chunk - The stringified JSON to parse and send to the subscriber
   */
Parses JSON and sends the chunk to the subscriber.
Also sends any errors to the subscriber.
Logs JSON parsing errors to the console with the offending JSON.
@param {Object} subscriber - The subscriber to send chunks
@param {String} chunk - The stringified JSON to parse and send to the subscriber
Parses JSON and sends the chunk to the subscriber . Also sends any errors to the subscriber . Logs JSON parsing errors to the console with the offending JSON . @param { Object } subscriber - The subscriber to send chunks @param { String } chunk - The stringified JSON to parse and send to the subscriber
sendChunk (subscriber, chunk) {
    if (chunk.length < 2) { return; }
    try { 
      const json = JSON.parse(chunk);
      subscriber.next(json);
    } catch (err) {
      subscriber.error(`ERROR: ${err}`);
      console.log(`Error parsing this chunk:\n${chunk}`);
    }
  }
sendChunk ( subscriber , chunk ) { if ( chunk . length < 2 ) { return ; } try { const json = JSON . parse ( chunk ) ; subscriber . next ( json ) ; } catch ( err ) { subscriber . error ( ` ${ err } ` ) ; console . log ( ` \n ${ chunk } ` ) ; } }
Parses JSON and sends the chunk to the subscriber.
Parses JSON and sends the chunk to the subscriber .
// Skip the chunk that is just [ // try to parse and send the chunk