Skip to content

Instantly share code, notes, and snippets.

View kgurchiek's full-sized avatar

Cornbread2100 kgurchiek

View GitHub Profile
@jasoncg
jasoncg / webrtc_example.js
Created August 13, 2019 23:04
A minimal WebRTC DataChannel example
/**
* A minimal example of a WebRTC data channel on a single host.
* After running, use dcRemote.send('message') or dcLocal.send('message') to send messages between local and remote peers
**/
let peerLocal = new RTCPeerConnection();
let peerRemote = new RTCPeerConnection();
peerLocal.onconnectionstatechange = function(e) {
console.log('peerLocal', 'onconnectionstatechange', e);
@hitthemoney
hitthemoney / Krunker WebSockets Explained.md
Last active May 1, 2024 08:03
This markdown file explains Krunker.io's social websockets and how to connect, get data from them, captchas, and more.

Krunker WebSockets Explained

WebSocket

WebSocket is a protocol over http. You should read: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API for more info on WebSocket.

Encoding/Decoding

Krunker uses msgpack for decoding and encoding packets. Msgpack is also smaller and sometimes faster depending on the implementation you use/make.

Packets

Like I said earlier, Krunker uses msgpack for decoding and encoding packets. A ping packet would like this: ["po"] which you send when you get a ["pi"] packet, and the ping result packet you receive is ["pir", ]. For fetching a profile, you can use ["r", "profile", , null]. The result packet would be like ["0", "profile", , , , , ...etc]. For finding packets, you can download https://krunker.io/social.html using a command like cURL, formatting the file and lo