TypeError:无法读取属性'emit'

时间:2017-12-06 09:25:18

标签: javascript undefined

  

[2017-12-05 23:15:02.546] [错误]默认 - TypeError:无法读取undefined属性'emit'       在Query._callback(/home/Bot/cf.js:5206:59)       在Query.Sequence.end(/home/Bot/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)       在Query._handleFinalResultPacket(/home/Bot/node_modules/mysql/lib/protocol/sequences/Query.js:137:8)       在Query.EofPacket(/home/Bot/node_modules/mysql/lib/protocol/sequences/Query.js:121:8)       在Protocol._parsePacket(/home/Bot/node_modules/mysql/lib/protocol/Protocol.js:280:23)       在Parser.write(/home/Bot/node_modules/mysql/lib/protocol/Parser.js:75:12)       在Protocol.write(/home/Bot/node_modules/mysql/lib/protocol/Protocol.js:39:16)       在Socket。 (/home/Bot/node_modules/mysql/lib/Connection.js:103:28)       在emitOne(events.js:96:13)       在Socket.emit(events.js:188:7)

并且代码行5206是

function newBalance(hash)
{
  pool.query('SELECT balance FROM users WHERE hash = ' + pool.escape(hash), function(err, row) {
    if(err) throw err;
    if(row.length == 0) return;

    steamIDCsrf[hash]['balance'] = row[0].balance;
    var balanta = steamIDCsrf[hash]['balance'];
    var steamid = steamIDCsrf[hash]['steamid'];

    if(socketBySteam.hasOwnProperty(steamid))
    {
      io.sockets.connected[socketBySteam[steamid]['info']].emit('message', {
        type: 'balance',
        new: balanta
      });
    }
  });
}

第5206行是io.sockets.connected[socketBySteam[steamid]['info']].emit('message', {

0 个答案:

没有答案