From 493c21968b2758fe987e63a7b7750427c726068d Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Fri, 16 Sep 2022 12:54:02 +1000 Subject: Probably broken merge from webrtc --- webrtc/src/opcodes/index.ts | 52 ++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) (limited to 'webrtc/src/opcodes/index.ts') diff --git a/webrtc/src/opcodes/index.ts b/webrtc/src/opcodes/index.ts index 4d4dbc30..8c664cce 100644 --- a/webrtc/src/opcodes/index.ts +++ b/webrtc/src/opcodes/index.ts @@ -1,43 +1,19 @@ -import { WebSocket } from "@fosscord/gateway"; -import { VoiceOPCodes } from "@fosscord/util"; -import { Server } from "../Server"; - -export interface Payload { - op: number; - d: any; - s: number; - t: string; -} - +import { Payload, WebSocket } from "@fosscord/gateway"; +import { VoiceOPCodes } from "../util"; +import { onBackendVersion } from "./BackendVersion"; +import { onHeartbeat } from "./Heartbeat"; import { onIdentify } from "./Identify"; import { onSelectProtocol } from "./SelectProtocol"; -import { onHeartbeat } from "./Heartbeat"; import { onSpeaking } from "./Speaking"; -import { onResume } from "./Resume"; -import { onConnect } from "./Connect"; - -import { onVersion } from "./Version"; - -export type OPCodeHandler = (this: Server, socket: WebSocket, data: Payload) => any; +import { onVideo } from "./Video"; -const handlers: { [key: number]: OPCodeHandler } = { - [VoiceOPCodes.IDENTIFY]: onIdentify, //op 0 - [VoiceOPCodes.SELECT_PROTOCOL]: onSelectProtocol, //op 1 - //op 2 voice_ready - [VoiceOPCodes.HEARTBEAT]: onHeartbeat, //op 3 - //op 4 session_description - [VoiceOPCodes.SPEAKING]: onSpeaking, //op 5 - //op 6 heartbeat_ack - [VoiceOPCodes.RESUME]: onResume, //op 7 - //op 8 hello - //op 9 resumed - //op 10? - //op 11? - [VoiceOPCodes.CLIENT_CONNECT]: onConnect, //op 12 - //op 13? - //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, -}; +export type OPCodeHandler = (this: WebSocket, data: Payload) => any; -export default handlers; \ No newline at end of file +export default { + [VoiceOPCodes.HEARTBEAT]: onHeartbeat, + [VoiceOPCodes.IDENTIFY]: onIdentify, + [VoiceOPCodes.VOICE_BACKEND_VERSION]: onBackendVersion, + [VoiceOPCodes.VIDEO]: onVideo, + [VoiceOPCodes.SPEAKING]: onSpeaking, + [VoiceOPCodes.SELECT_PROTOCOL]: onSelectProtocol +}; \ No newline at end of file -- cgit 1.5.1