You've got no variable client
. Use socket
instead.
Change the line
playerlist[playerlist.length+1] = [client.id,username]
to
playerlist[playerlist.length] = [socket.id,username]
By the way, I think you should use playerlist.length
here.