Agregado codigo para permitir reconexiones

master
Araozu 2020-09-23 17:00:52 -05:00
parent e34c4bcc98
commit 623437edf9
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package dev.araozu package dev.araozu
import io.ktor.http.cio.websocket.* import io.ktor.http.cio.websocket.*
import kotlinx.coroutines.isActive
object GestorJuegos { object GestorJuegos {
@ -43,7 +44,7 @@ object GestorJuegos {
private suspend fun broadcast(juego: Juego, mensaje: String) { private suspend fun broadcast(juego: Juego, mensaje: String) {
juego.conexiones.forEach { (_, socket) -> juego.conexiones.forEach { (_, socket) ->
socket.send(Frame.Text(mensaje)) if (socket.isActive) socket.send(Frame.Text(mensaje))
} }
} }