AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Debug Server (node server.js)
 
 

I made a simple patch to the server.js source code to display internal messages as the occur…


$ node debugserver.js
Express server listening on port 8080
connection detected
handleControlMessage: {"status":"register","id":"judge0","secret":"judge0secret"}
validate: {"status":"register","id":"judge0","secret":"judge0secret"}
connection detected
handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

( Repeats many times… )

handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
handleDisconnect: transport close
connection detected
handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

( Repeats many times… )

handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

connection detected
handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

handleControlMessage: {"status":"register","id":"ai0","secret":"ai0secret"}
validate: {"status":"register","id":"ai0","secret":"ai0secret"}

handleControlMessage: {"status":"roundStatus","id":"ai0","secret":"ai0secret"}
validate: {"status":"roundStatus","id":"ai0","secret":"ai0secret"}

handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

( Repeats many times… )

handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

handleCommunicationMessage: {"contents":"You chatted: hello","id":"ai0","secret":"ai0secret"}
validate: {"contents":"You chatted: hello","id":"ai0","secret":"ai0secret"}
handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

( Repeats many times… )

handleControllerMessage: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}
validate: {"status":"statusUpdate","id":"CONTROLLER","secret":"CP0secret"}

handleCommunicationMessage: {"contents":"hello","id":"judge0","secret":"judge0secret"}
validate: {"contents":"hello","id":"judge0","secret":"judge0secret"}

/var/www/html/LPC2/debugserver.js:88
  return config.rounds[round][0][judgeNumber];
                    ^
TypeError: Cannot read property ‘0’ of undefined
  at getConfederateForJudge (/var/www/html/LPC2/debugserver.js:88:30)
  at getConfederateForJudgeByName (/var/www/html/LPC2/debugserver.js:108:29)
  at handleCommunicationMessage (/var/www/html/LPC2/debugserver.js:228:28)
  at Socket.<anonymous> (/var/www/html/LPC2/debugserver.js:349:38)
  at emitOne (events.js:77:13)
  at Socket.emit (events.js:169:7)
  at /var/www/html/LPC2/node_modules/socket.io/lib/socket.js:509:12
  at nextTickCallbackWith0Args (node.js:419:9)
  at process._tickCallback (node.js:348:13)

 

 
  [ # 1 ]

Found this in the source code…

//TODO: catch appropriate exception if judgeNumber or round is incorrect 

line 88 is this function…

function getConfederateForJudge(judgeNumber,round)
{
  
return config.rounds[round][0][judgeNumber];

 

 

 
  login or register to react