Arrange the code so that if the user sends a text frame, the server first thanks the user, then saves the message in a variable and sends back its length.
WebSockets
Find out the length
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
send(Frame.Text("Thank you for the message!"))
for (frame in incoming) {
val receivedText = frame.readText()
}
frame as? Frame.Text ?: continue
send(Frame.Text("Length of your word is ${receivedText.length}"))
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.