Skip to content

Commit

Permalink
Try to fix issue with frame sending
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Feb 15, 2025
1 parent d337f43 commit 2200011
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions server/src/main/kotlin/Server.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.ktor.server.plugins.*
import io.ktor.server.plugins.forwardedheaders.*
import io.ktor.server.routing.*
import io.ktor.server.websocket.*
import io.ktor.websocket.*

private val LOG = KotlinLogging.logger { }

Expand All @@ -27,9 +28,12 @@ fun main() {
for (frame in incoming) {
LOG.debug { "GOT FRAME: $frame" }

sessions.forEach {
if (it != this) {
it.send(frame)
if (frame is Frame.Text) {
LOG.debug { "Got frame text: ${frame.readText()}" }

val copy = Frame.Text(frame.fin, frame.data)
sessions.forEach {
it.send(copy)
}
}
}
Expand Down

0 comments on commit 2200011

Please sign in to comment.