diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-14 20:54:43 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-07-14 20:54:43 +1000 |
commit | a620b3a31a9ad5a00551b14806ba50c2865b91d5 (patch) | |
tree | 48d4ae88946097cf0d429f96085f287b7b95803f /webrtc/src | |
parent | Remove a console log from the maddyrtc branch (diff) | |
parent | dumb typing stuff (diff) | |
download | server-a620b3a31a9ad5a00551b14806ba50c2865b91d5.tar.xz |
Merge branch 'maddyrtc' into slowcord
Diffstat (limited to 'webrtc/src')
-rw-r--r-- | webrtc/src/opcodes/Identify.ts | 2 | ||||
-rw-r--r-- | webrtc/src/opcodes/SelectProtocol.ts | 2 | ||||
-rw-r--r-- | webrtc/src/opcodes/index.ts | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/webrtc/src/opcodes/Identify.ts b/webrtc/src/opcodes/Identify.ts index ef0386a7..210b5041 100644 --- a/webrtc/src/opcodes/Identify.ts +++ b/webrtc/src/opcodes/Identify.ts @@ -18,7 +18,7 @@ export interface IdentifyPayload extends Payload { }; } -export async function onIdentify(this: Server, socket: WebSocket, data: IdentifyPayload) { +export async function onIdentify(this: Server, socket: WebSocket, data: Payload) { const session = await Session.findOneOrFail( { session_id: data.d.session_id, }, diff --git a/webrtc/src/opcodes/SelectProtocol.ts b/webrtc/src/opcodes/SelectProtocol.ts index 72fb9c79..71772454 100644 --- a/webrtc/src/opcodes/SelectProtocol.ts +++ b/webrtc/src/opcodes/SelectProtocol.ts @@ -88,7 +88,7 @@ export interface SelectProtocolPayload extends Payload { } */ -export async function onSelectProtocol(this: Server, socket: WebSocket, data: SelectProtocolPayload) { +export async function onSelectProtocol(this: Server, socket: WebSocket, data: Payload) { if (data.d.sdp) { const rtpCapabilities = this.mediasoupRouters[0].rtpCapabilities; const codecs = rtpCapabilities.codecs as RtpCodecCapability[]; diff --git a/webrtc/src/opcodes/index.ts b/webrtc/src/opcodes/index.ts index d0f40bc2..4d4dbc30 100644 --- a/webrtc/src/opcodes/index.ts +++ b/webrtc/src/opcodes/index.ts @@ -1,5 +1,6 @@ import { WebSocket } from "@fosscord/gateway"; import { VoiceOPCodes } from "@fosscord/util"; +import { Server } from "../Server"; export interface Payload { op: number; @@ -17,9 +18,9 @@ import { onConnect } from "./Connect"; import { onVersion } from "./Version"; -export type OPCodeHandler = (this: WebSocket, data: Payload) => any; +export type OPCodeHandler = (this: Server, socket: WebSocket, data: Payload) => any; -export default { +const handlers: { [key: number]: OPCodeHandler } = { [VoiceOPCodes.IDENTIFY]: onIdentify, //op 0 [VoiceOPCodes.SELECT_PROTOCOL]: onSelectProtocol, //op 1 //op 2 voice_ready @@ -37,4 +38,6 @@ export default { //op 15? //op 16? empty data on client send but server sends {"voice":"0.8.24+bugfix.voice.streams.opt.branch-ffcefaff7","rtc_worker":"0.3.14-crypto-collision-copy"} [VoiceOPCodes.VERSION]: onVersion, -}; \ No newline at end of file +}; + +export default handlers; \ No newline at end of file |