mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
relay: only send if socket is open
This commit is contained in:
parent
f7cd67c572
commit
b60e84d29b
2 changed files with 3 additions and 2 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { AppController } from '@/app.ts';
|
||||
import { type Event } from '@/deps.ts';
|
||||
import { type DittoFilter } from '@/filter.ts';
|
||||
import { TOKEN_REGEX } from '@/middleware/auth19.ts';
|
||||
import { streamSchema, ws } from '@/stream.ts';
|
||||
|
|
|
|||
|
|
@ -90,7 +90,9 @@ function connectStream(socket: WebSocket) {
|
|||
|
||||
/** Send a message back to the client. */
|
||||
function send(msg: RelayMsg): void {
|
||||
return socket.send(JSON.stringify(msg));
|
||||
if (socket.readyState === WebSocket.OPEN) {
|
||||
socket.send(JSON.stringify(msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue