messing around with things I don't understand

This commit is contained in:
Madeline
2022-01-16 03:35:30 +11:00
parent 1569fec0cf
commit aa0357e060
7 changed files with 81 additions and 13 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { WebSocket } from "@fosscord/gateway";
import { Payload } from "./index";
import { Server } from "../Server"
export async function onConnect(socket: WebSocket, data: Payload) {
export async function onConnect(this: Server, socket: WebSocket, data: Payload) {
}
+2 -1
View File
@@ -1,7 +1,8 @@
import { WebSocket } from "@fosscord/gateway";
import { Payload } from "./index";
import { setHeartbeat } from "./../util";
import { Server } from "../Server"
export async function onHeartbeat(socket: WebSocket, data: Payload) {
export async function onHeartbeat(this: Server, socket: WebSocket, data: Payload) {
await setHeartbeat(socket);
}
+5 -2
View File
@@ -1,14 +1,17 @@
import { WebSocket } from "@fosscord/gateway";
import { Payload } from "./index"
import { VoiceOPCodes } from "@fosscord/util";
import { Server } from "../Server"
export async function onIdentify(socket: WebSocket, data: Payload) {
export async function onIdentify(this: Server, socket: WebSocket, data: Payload) {
socket.send(JSON.stringify({
op: VoiceOPCodes.READY,
d: {
ssrc: 1,
ip: "127.0.0.1",
port: 3005,
//@ts-ignore
port: this.mediasoupTransports[0].iceCandidates.port,
modes: [
"xsalsa20_poly1305",
"xsalsa20_poly1305_suffix",
+2 -1
View File
@@ -1,5 +1,6 @@
import { WebSocket } from "@fosscord/gateway";
import { Payload } from "./index";
import { Server } from "../Server"
export async function onResume(socket: WebSocket, data: Payload) {
export async function onResume(this: Server, socket: WebSocket, data: Payload) {
}
+3 -2
View File
@@ -1,15 +1,16 @@
import { WebSocket } from "@fosscord/gateway";
import { Payload } from "./index";
import { VoiceOPCodes } from "@fosscord/util";
import { Server } from "../Server"
export async function onSelectProtocol(socket: WebSocket, data: Payload) {
export async function onSelectProtocol(this: Server, socket: WebSocket, data: Payload) {
socket.send(JSON.stringify({
op: VoiceOPCodes.SESSION_DESCRIPTION,
d: {
video_codec: "H264",
secret_key: new Array(32).fill(null).map(x => Math.random() * 256),
mode: "aead_aes256_gcm_rtpsize",
media_session_id: "d8eb5c84d987c6642ec4ce72ffa97f00",
media_session_id: this.mediasoupTransports[0].id,
audio_codec: "opus",
}
}));
+2 -1
View File
@@ -1,6 +1,7 @@
import { WebSocket } from "@fosscord/gateway";
import { Payload } from "./index"
import { VoiceOPCodes } from "@fosscord/util";
import { Server } from "../Server"
export async function onSpeaking(socket: WebSocket, data: Payload) {
export async function onSpeaking(this: Server, socket: WebSocket, data: Payload) {
}