add AutoCloseWebSocketHandler

This commit is contained in:
tursom 2021-04-26 16:27:52 +08:00
parent f53f5dfd94
commit 775bfbffc1

View File

@ -0,0 +1,26 @@
package cn.tursom.core.ws
import io.netty.buffer.ByteBuf
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame
interface AutoCloseWebSocketHandler : WebSocketHandler {
override fun readMessage(client: WebSocketClient, msg: TextWebSocketFrame) {
super.readMessage(client, msg)
msg.release()
}
override fun readMessage(client: WebSocketClient, msg: ByteBuf) {
super.readMessage(client, msg)
msg.release()
}
override fun readPing(client: WebSocketClient, msg: ByteBuf) {
super.readPing(client, msg)
msg.release()
}
override fun readPong(client: WebSocketClient, msg: ByteBuf) {
super.readPong(client, msg)
msg.release()
}
}