add onerror when websocket is null

pull/959/head
greenart7c3 2024-06-30 09:35:17 -03:00
rodzic 5c21e219fe
commit 3d497ccf4d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 885822EED3A26A6D
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -524,9 +524,17 @@ class Relay(
}
private fun writeToSocket(str: String) {
if (socket == null) {
listeners.forEach { listener ->
listener.onError(
this@Relay,
"",
Error("Failed to send $str. Relay is not connected."),
)
}
}
socket?.let {
checkNotInMainThread()
val result = it.send(str)
listeners.forEach { listener ->
listener.onSend(this@Relay, str, result)