summary refs log tree commit diff
path: root/webrtc/src/opcodes/index.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-01-16 02:37:38 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-01-16 02:38:43 +1100
commit1569fec0cf23442b176b2a9a775208349aa719ed (patch)
treef36aff30a3d5e82f569fa7815c83a33a3066c7d3 /webrtc/src/opcodes/index.ts
parentFix typo in commit 277b28c (diff)
downloadserver-1569fec0cf23442b176b2a9a775208349aa719ed.tar.xz
boilerplate stuff
Diffstat (limited to '')
-rw-r--r--webrtc/src/opcodes/index.ts35
1 files changed, 35 insertions, 0 deletions
diff --git a/webrtc/src/opcodes/index.ts b/webrtc/src/opcodes/index.ts
new file mode 100644

index 00000000..2fe69c38 --- /dev/null +++ b/webrtc/src/opcodes/index.ts
@@ -0,0 +1,35 @@ +import { WebSocket } from "@fosscord/gateway"; +import { VoiceOPCodes } from "@fosscord/util"; + +export interface Payload { + op: number; + d?: any; + s?: number; + t?: string; +} + +import { onIdentify } from "./Identify"; +import { onSelectProtocol } from "./SelectProtocol"; +import { onHeartbeat } from "./Heartbeat"; +import { onSpeaking } from "./Speaking"; +import { onResume } from "./Resume"; +import { onConnect } from "./Connect"; + +export type OPCodeHandler = (this: WebSocket, data: Payload) => any; + +export default { + [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? +}; \ No newline at end of file