Skip to content

Instantly share code, notes, and snippets.

@TheRealRyGuy
Last active June 23, 2023 02:19
Show Gist options
  • Save TheRealRyGuy/0efaaa7d5d0904de591db416784498ff to your computer and use it in GitHub Desktop.
Save TheRealRyGuy/0efaaa7d5d0904de591db416784498ff to your computer and use it in GitHub Desktop.
Kahoot Handshake Information - Going to notate future Kahoot Protocol information

Kahoot Protocol

Huge Shoutouts to msemple1111 and his protocol information here that supplied a lot of information for this

Terms to Know

Epoch: Unit of Time used by Unix - counts time from January 1st 1970 to current time in seconds (converter)


Handshake Requests Returns Service Token GET: https://kahoot.it/reserve/session/*pin*/?*time

Parameter Purpose
Pin Game Pin of Game
Time Time of request in Epoch

Proper Response: Empty JSON with Header x-kahoot-session-token Bad Response: Response body String: Not found

Move on if you get a Proper Response


Game Register Ping Kahoot and Browser websocket contact GET: https://kahoot.it/cometd/*pin*/*session-token*

Parameter Purpose
Pin Game Pin of Game
Session-Token Session Token from Handshake

Proper Response: 400 Code with some HTML

Move on if you get a proper response


Registration Process Beginning Registration Process POST: POST https://kahoot.it/cometd/*pin*/*session-token*/handshake

Parameter Purpose
Pin Game Pin of Game
Session-Token Session Token from Handshake

What to Post Example Post:

     [
      {
         "advice": {
             "interval": 0, 
             "timeout": 60000
         }, 
         "channel": "/meta/handshake", 
         "ext": {
             "ack": true, 
             "timesync": {
                 "l": 0, 
                 "o": 0, 
                 "tc": 1477400825756
             }
         }, 
         "id": "2", 
         "minimumVersion": "1.0", 
         "supportedConnectionTypes": [
             "long-polling"
         ], 
         "version": "1.0"
      }
     ]

Breaking it Down

  • Advice

Telling Kahoot when to drop the browser on non-responsiveness

Parameter Purpose
Interval Intervals of Checks
Timeout Length of time before dropping browser
  • Channel Channel Value tells what you want to do. All Possible Channels:

  • /meta/handshake

    • Basic Handshake Channel
  • /meta/subscribe

  • /meta/connect

  • /meta/unsubscribe

  • Ext

Used to sync time with Kahoot server and client

Parameter Purpose
l Network Lag - Client Calculated
o Clock Offset that the client has calculated
tc Client Timestamp in ms since 1970 (epoch) when the message was sent
  • Id

Connection value attempt to /cometd The First connection is 1, runs on increments of 1

  • Minimum Version

Negotiates Protocol Version, can just leave as default


Example Login WebSocket Information

Later Information for Additions

Services

  • /service/controller
  • /service/player
  • /service/status

Playing Kahoot through Requests

Requests for playing are done through the /service/player subscription. ID's for Playing:

ID Function
1 Questions answer prompt before answers are displayed are screen
2 Start Question
3 End of quiz - with total points, rank and your question answers
4 End of question
5 ??????
6 ????????
7 Post answer received - display a message
8 Question Correct? - with points and total points - and rank
9 Start of quiz only - returns name of quiz
10 ??????
11 ??????
12 Quiz Feedback
13 Quiz Closed
14 Confirmed connection - returns name and quiz type
@TheRealRyGuy
Copy link
Author

TheRealRyGuy commented Oct 4, 2017

Observing Websocket information on Kahoot using Google Chrome and Chrome Developer Tools

Open the Chrome Developer Tools by

  • Mac shortcut: Command + Option + i
  • Windows shortcut: Control + Shift + i
  • Right Click on the Page and press Inspect
  • Press on the button on the Top Right, Hover over More Tools click Developer Tools
    Once you're there, press on Network, then WS and you can observe all websocket activity

and please ignore my horrible markdown skill

Copy link

ghost commented Dec 3, 2019

How would I play using POST and GET requests?

@McMistrzYT
Copy link

How would I play using POST and GET requests?

It's not using POST and GET requests, it's using the WebSocket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment