Time to exit

Report a typo

Arrange the code so that if the user sends a text frame, the server shows the user's message, but if the user sends "exit" the server sends a farewell message and closes the connection.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                }
              
                send(Frame.Text("You enter: \"$receivedText\""))
              
                }
              
                frame as? Frame.Text ?: continue
              
                close(CloseReason(CloseReason.Codes.NORMAL, "Client exit"))
              
                val receivedText = frame.readText()
              
                } else {
              
                for (frame in incoming) {
              
                if (receivedText.equals("exit", ignoreCase = true)) {
              
                send(Frame.Text("Good bye!"))
              
___

Create a free account to access the full topic