title: How can I emit an array of objects using socket.io and cryptojs with sql server results?
body: <p>I'm trying to emit an array using Socket.io, but I'm getting a error. The code and error is below. I'm new to using WebSockets, so what can I do to emit this properly? </p>
  
  <pre><code>var conn = new sql.ConnectionPool(dbConfig);
  var req = new sql.Request(conn);
   conn.connect(function(err){
    if(err){
      console.log("err");
      return;
    }
    console.log('conectou')
    let vend = 'AUGUSTO'
    req.query(`select * from aca_visitas where cd_vend = '${vend}' and 
       dt_visita &gt;= '2019-03-01'`, 
    function(err, array){
  
      if(err)
      {
        console.log("err db");
      }
      else{
        let resultado = array.recordset
        console.log(resultado)
        var ciphertext = CryptoJS.AES.encrypt(JSON.stringify(resultado), 
            'secret key 123');
        io.emit("Data-from-server",ciphertext);
  }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>C:\Trabalho\Projetos\MobSupervisor\TargetMobSupervisor\Prototipo\Retaguarda\node_modules\has-binary2\index.js:30
  function hasBinary (obj) {
                     ^
  
  RangeError: Maximum call stack size exceeded
  </code></pre>