essential.handlePacket
Prototype
function handlePacket(playername, packetType ,dataObject, gameIsPlaying, playerIsInGame)
Input parameters
playername - the user name of the who sent the packet
packetType - type of the packet
dataObject - the data array object associated with the packet
gameIsPlaying - true if the game has currently a state
playerIsInGame - included for future compatibility, set to true
Return value
null
Description
Handles a data packet sent from one of the connected game clients.
Example code
function handlePacket(playerName, packetType ,dataObject, gameIsPlaying,
playerIsInGame)
{
if (packetType == PACK_ANSWER)
{
// This is a answer packet
if (dataObject.answer == g_correctAnswer)
{
// Answer was correct!
}
}
else
{
// We have received an invalid packet, report a possible hacking attempt
removeCheater(playername);
}
}
