summary refs log tree commit diff
path: root/src/webrtc/util/Send.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/webrtc/util/Send.ts')
-rw-r--r--src/webrtc/util/Send.ts24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/webrtc/util/Send.ts b/src/webrtc/util/Send.ts

index 1d8aa61e..c3f47bae 100644 --- a/src/webrtc/util/Send.ts +++ b/src/webrtc/util/Send.ts
@@ -1,3 +1,21 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + import { JSONReplacer } from "@spacebar/util"; import { VoicePayload } from "./Constants"; import { WebRtcWebSocket } from "./WebRtcWebSocket"; @@ -12,13 +30,13 @@ export function Send(socket: WebRtcWebSocket, data: VoicePayload) { else return; return new Promise((res, rej) => { - if (socket.readyState !== 1) { + if (socket.rawSocket.readyState !== 1) { // return rej("socket not open"); - socket.close(); + socket.rawSocket.close(); return; } - socket.send(buffer, (err) => { + socket.rawSocket.send(buffer, (err) => { if (err) return rej(err); return res(null); });