summary refs log tree commit diff
path: root/src/webrtc/opcodes/SelectProtocol.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/webrtc/opcodes/SelectProtocol.ts')
-rw-r--r--src/webrtc/opcodes/SelectProtocol.ts27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/webrtc/opcodes/SelectProtocol.ts b/src/webrtc/opcodes/SelectProtocol.ts

index 2aa841f2..a29bcacc 100644 --- a/src/webrtc/opcodes/SelectProtocol.ts +++ b/src/webrtc/opcodes/SelectProtocol.ts
@@ -16,34 +16,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ import { SelectProtocolSchema, validateSchema } from "@spacebar/schemas"; -import { - VoiceOPCodes, - VoicePayload, - WebRtcWebSocket, - mediaServer, - Send, -} from "@spacebar/webrtc"; +import { VoiceOPCodes, VoicePayload, WebRtcWebSocket, mediaServer, Send } from "@spacebar/webrtc"; -export async function onSelectProtocol( - this: WebRtcWebSocket, - payload: VoicePayload, -) { +export async function onSelectProtocol(this: WebRtcWebSocket, payload: VoicePayload) { if (!this.webRtcClient) return; - const data = validateSchema( - "SelectProtocolSchema", - payload.d, - ) as SelectProtocolSchema; + const data = validateSchema("SelectProtocolSchema", payload.d) as SelectProtocolSchema; // UDP protocol not currently supported. Maybe in the future? - if (data.protocol !== "webrtc") - return this.close(4000, "only webrtc protocol supported currently"); + if (data.protocol !== "webrtc") return this.close(4000, "only webrtc protocol supported currently"); - const response = await mediaServer.onOffer( - this.webRtcClient, - data.sdp!, - data.codecs ?? [], - ); + const response = await mediaServer.onOffer(this.webRtcClient, data.sdp!, data.codecs ?? []); await Send(this, { op: VoiceOPCodes.SESSION_DESCRIPTION,