Class: Client

Client(options)

new Client(options)

constructor - Create a Kahoot! client.
Parameters:
Name Type Description
options Object Sets up the client. Options can control what events and methods are available to the client. By default, all options are enabled, besides proxies.
Source:

Namespaces

data
defaults
quiz

Methods

(static) defaults() → {class}

Source:
Returns:
Returns a new Client constructor which uses new defaults
Type
class

(static) join() → {Object}

Properties:
Name Type Description
client Client The newly created client joining the game
event Promise.<LiveEventTimetrack> See Client#join
Source:
See:
Returns:
Returns the Client instead of a Promise.
Type
Object

answer(choice) → {Promise.<LiveEventTimetrack>}

Answer a question
Parameters:
Name Type Description
choice Number | String | Array.<Number> The answer to the question - defaults: - 1 answer, number: 0 - multi answer: [0,1,2,3] - "undefined"
Source:
Returns:
Resolves when answer is received.
Type
Promise.<LiveEventTimetrack>

(async) answerTwoFactorAuth(stepsopt) → {Promise.<LiveEventTimetrack>}

Answer the Two Factor Authentification
Parameters:
Name Type Attributes Default Description
steps Array.<Number> <optional>
[0,1,2,3] A list of four numbers (0,1,2,3). Each number represents one of the four colors in the two-factor code (red,blue,yellow,green) respectively
Source:
Returns:
Resolves when the message is sent and received. Rejects if the message fails to send.
Type
Promise.<LiveEventTimetrack>

(async) join(name, teamopt) → {Promise.<Object>}

Join a game. Also joins with team members.
Parameters:
Name Type Attributes Default Description
name String The name of the player
team Array.<String> | Boolean <optional>
["Player 1","Player 2","Player 3","Player 4"] The team member names. if false, the team members will not be added automatically.
Source:
Returns:
Resolves when join + team (if applicable) succeeds The resolved object should contain information about twoFactor, namerator, and gameMode If joining fails, this will reject with the error
Type
Promise.<Object>

(async) joinTeam(teamopt) → {Promise.<LiveEventTimetrack>}

Send team members
Parameters:
Name Type Attributes Default Description
team Array.<String> <optional>
["Player 1","Player 2","Player 3","Player 4"] A list of team members names
Source:
Returns:
Resolves when the team members are sent. Rejects if for some reason the message was not received by Kahoot!'s server.
Type
Promise.<LiveEventTimetrack>

leave()

leave - Leave the game.
Source:

next()

next - Go to the next part (challenge)
Source:

reconnect(pinopt, cidopt)

reconnect to a game
Parameters:
Name Type Attributes Description
pin Number | String <optional>
The gameid to connect to
cid String.<Number> | Number <optional>
The client id to reconnect as
Source:

sendFeedback(fun, learn, recommend, overall) → {Promise.<LiveEventTimetrack>}

Send feedback to the host
Parameters:
Name Type Description
fun Number 1-5. Rating for how fun the quiz was
learn Number 0/1. Whether the client learned anything from the quiz
recommend Number 0/1. Whether the client would recommend the quiz
overall Number 1 - 1. The overall feeling of the client.
Source:
Returns:
Resolves when the feedback has been sent.
Type
Promise.<LiveEventTimetrack>

Events

Disconnect

Emitted when the client is disconnected. Emits a String with the reason the client was disconnected.
Type:
  • String
Source:

Feedback

Emitted when the host requests for feedback
Type:
  • Object
Properties:
Name Type Description
quizType String
Source:

GameReset

Emitted when the host presses "play again" or continues to the next quiz in the list.
Source:

Joined

Emitted when the client joins the game
Type:
  • Object
Properties:
Name Type Description
challenge String.<function()> The challenge function. (Pointless)
namerator Boolean Whether the game has the friendly name generator on.
participantId Boolean
smartPractice Boolean
twoFactorAuth Boolean Whether the game has twoFactorAuth enabled
gameMode String | undefined If the gameMode is 'team,' then it is team mode, else it is the normal classic mode.
Source:

NameAccept

Emitted when the server has validated the client's name
Type:
  • Object
Properties:
Name Type Description
playerName String The player's name (may have changed from original value due to filter)
quizType String
playerV2 Boolean
Source:

Podium

Emitted at the end of the game (After "QuizEnd")
Type:
  • Object
Properties:
Name Type Description
podiumMedalType String A string about the podium medal. "gold", "silver", "bronze" are possible values. May be nonexistent or null.
Source:

QuestionEnd

An event emitted at the end of the question. Contains ranking information.
Type:
  • Object
Properties:
Name Type Description
choice Number | Array.<Number> | String The answer from the client
type String The question type
isCorrect Boolean Whether the client answered the question correctly
text String The text content of correct answers
receivedTime Number The time (ms) when the answer was received
pointsQuestion Booean Whether the question offered points
points Number The amount of points earned from the question
correctAnswers Array.<String> A list of the text content of the correct answers
correctChoices Array.<Number> A list of the indexes of correct choices (used in multi select quizzes)
totalScore Number The total score of the client
rank Number The current position of the client
pointsData PointsData Extra information about the points data
nemesis Nemesis The nemesis
Source:

QuestionReady

Emitted when the question is about to start
Type:
  • Object
Properties:
Name Type Description
questionIndex Number The question index
gameBlockType String The question type
gameBlockLayout String The question layout
quizQuestionAnswers Array.<Number> An array of numbers, signifying the number of answer choices in each question
timeLeft Number The time in seconds before the quiz starts
Source:

QuestionStart

Emitted when the question starts
Type:
  • Object
Properties:
Name Type Description
questionIndex Number The question index
gameBlockType String The question type
gameBlockLayout String The layout of the question. May be nonexistent
quizQuestionAnswers Array.<Number> An array of numbers, signifying the number of answer choices in each question
timeAvailable Number The time available in the question.
Source:

QuizEnd

Emitted when the quiz ends.
Type:
  • Object
Properties:
Name Type Description
rank Number The rank of the player
cid String.<Number> The player id
correctCount Number The number of correct answers
incorrectCount Number The number of incorrect answers
isKicked Boolean Whether the player was kicked?
isGhost Boolean Whether the player is a ghost.
unansweredCount Number The number of unanswered questions.
playerCount Number The number of players in the game.
startTime Number The date (ms) when the quiz started.
quizId String The quiz uuid
name String The name of the player
totalScore Number The final score of the player.
hostId String
challengeId null
isOnlyNonPointGameBlockKahoot Boolean Whether the kahoot is only non-point questions?
Source:

QuizStart

Emitted at the start of the quiz
Type:
  • Object
Properties:
Name Type Description
quizType String
quizQuestionAnswers Array.<Number> A list of numbers stating how many answers are in each question.
Source:

RecoveryData

Emitted when the server sends its recovery data. This event is mostly for debugging.
Source:
See:

TeamAccept

Emitted when the team members were accepted.
Type:
  • Object
Properties:
Name Type Description
memberNames Array.<String> The team members names.
recoveryData RecoveryData The recovery data (contains the current event)
Source:

TeamTalk

Emitted when team talk starts
Type:
  • Object
Properties:
Name Type Description
questionIndex Number The current question index
quizQuestionAnswers Array.<Number> A list about the number of choices per question.
gameBlockType String The question type
gameBlockLayout String The layout of the question
teamTalkDuration Number The number (in seconds) for team talk
Source:

TimeOver

Emitted when time is over (before QuestionEnd)
Type:
  • Object
Properties:
Name Type Description
questionNumber Number The question index.
Source:

TwoFactorCorrect

TwoFactorCorrect Event. Emitted when the two-factor auth was answered correctly. Enables other events to start.
Source:

TwoFactorReset

TwoFactorReset Event. Emitted when the two-factor auth resets and hasn't been answered correctly yet
Source:

TwoFactorWrong

TwoFactorWrong Event. Emitted when the two-factor auth was answered incorrectly.
Source: