dumb typing stuff
This commit is contained in:
parent
c46460eb76
commit
c78924ea67
BIN
webrtc/package-lock.json
generated
BIN
webrtc/package-lock.json
generated
Binary file not shown.
@ -14,7 +14,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^15.6.1",
|
||||
"@types/sdp-transform": "^2.4.5",
|
||||
"@types/ws": "^7.4.4",
|
||||
"@types/ws": "^7.4.7",
|
||||
"ts-node": "^10.4.0",
|
||||
"typescript": "^4.3.2"
|
||||
},
|
||||
@ -23,10 +23,10 @@
|
||||
"dotenv": "^12.0.4",
|
||||
"libsodium": "^0.7.10",
|
||||
"libsodium-wrappers": "^0.7.10",
|
||||
"mediasoup": "^3.9.5",
|
||||
"mediasoup": "^3.9.5-1",
|
||||
"node-turn": "^0.0.6",
|
||||
"sdp-transform": "^2.14.1",
|
||||
"tsconfig-paths": "^3.12.0",
|
||||
"ws": "^7.4.6"
|
||||
"ws": "^7.5.8"
|
||||
}
|
||||
}
|
||||
|
||||
@ -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, },
|
||||
|
||||
@ -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[];
|
||||
|
||||
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
export default handlers;
|
||||
Reference in New Issue
Block a user