Skip to content
Snippets Groups Projects
Unverified Commit 7a765fc7 authored by Davide Pianca's avatar Davide Pianca Committed by GitHub
Browse files

Merge pull request #60 from tomoakiichige/fix/client-websocket-ping-handling

Add handling for received websocket ping in mqtt-client
parents ddd67e9d 13579ef8
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,11 @@ public class WebSocket(private val socket: SocketInterface, host: String, path:
return null
}
private fun decodePing(length: ULong): UByteArray? {
send(decodeBinary(length), 0xA)
return null
}
private fun decodePong(length: ULong): UByteArray? {
decodeBinary(length)
return null
......@@ -156,6 +161,7 @@ public class WebSocket(private val socket: SocketInterface, host: String, path:
val decoded = when (opcode.toInt()) {
0x2 -> decodeBinary(length)
0x8 -> decodeClose(length)
0x9 -> decodePing(length)
0xA -> decodePong(length)
else -> {
close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment