This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Node | |
| class_name Peerjs | |
| const TOKEN := "thisismytokenidrkwhatthisdoes" # Yeah no idea what this does | |
| const BASE_URL := "wss://0.peerjs.com/peerjs?key=peerjs&id={0}&token={1}" # Formattable Base String | |
| const HEARTBEAT_INTERVAL := 5 # Heartbeat every 5 seconds | |
| signal offer_received(remote_peer_id: String, sdp: String) | |
| signal answer_received(remote_peer_id: String, sdp: String) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const http = require("http") | |
| const crypto = require("crypto") | |
| const server = http.createServer((req,res)=>{ | |
| res.write("hi") | |
| res.end() | |
| }) | |
| server.on("upgrade",(req,socket)=>{ | |
| const accept = crypto.Hash("sha1").update(req.headers["sec-websocket-key"]+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest("base64") |