Skip to content
Snippets Groups Projects
Unverified Commit 13579ef8 authored by Tomoaki Ichige's avatar Tomoaki Ichige
Browse files

fix: add handling for received websocket ping in mqtt-client

parent ddd67e9d
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: ...@@ -130,6 +130,11 @@ public class WebSocket(private val socket: SocketInterface, host: String, path:
return null return null
} }
private fun decodePing(length: ULong): UByteArray? {
send(decodeBinary(length), 0xA)
return null
}
private fun decodePong(length: ULong): UByteArray? { private fun decodePong(length: ULong): UByteArray? {
decodeBinary(length) decodeBinary(length)
return null return null
...@@ -156,6 +161,7 @@ public class WebSocket(private val socket: SocketInterface, host: String, path: ...@@ -156,6 +161,7 @@ public class WebSocket(private val socket: SocketInterface, host: String, path:
val decoded = when (opcode.toInt()) { val decoded = when (opcode.toInt()) {
0x2 -> decodeBinary(length) 0x2 -> decodeBinary(length)
0x8 -> decodeClose(length) 0x8 -> decodeClose(length)
0x9 -> decodePing(length)
0xA -> decodePong(length) 0xA -> decodePong(length)
else -> { else -> {
close() close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment