summary refs log tree commit diff
path: root/src/webrtc/util/Send.ts
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-15 17:09:40 +0200
committerRory& <root@rory.gay>2026-08-15 17:15:40 +0200
commit9f5f2a2c3b71550f21f75500534bf1332b94f771 (patch)
tree4572ef19b7e25fee06da36a62105b197cb45fade /src/webrtc/util/Send.ts
parentAllow avatar_description field in profile update (diff)
downloadserver-ts-dev/gwsep.tar.xz
Decouple gateway connection state from inner ws object github/dev/gwsep dev/gwsep
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); });