All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.ditchoom.mqtt3.controlpacket.UnsubscribeAcknowledgment.kt Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.ditchoom.mqtt3.controlpacket

import com.ditchoom.buffer.ReadBuffer
import com.ditchoom.buffer.WriteBuffer
import com.ditchoom.mqtt.controlpacket.IUnsubscribeAcknowledgment
import com.ditchoom.mqtt.controlpacket.format.fixed.DirectionOfFlow

data class UnsubscribeAcknowledgment(override val packetIdentifier: Int) :
    ControlPacketV4(IUnsubscribeAcknowledgment.controlPacketValue, DirectionOfFlow.SERVER_TO_CLIENT),
    IUnsubscribeAcknowledgment {
    override fun remainingLength() = 2

    override fun variableHeader(writeBuffer: WriteBuffer) {
        writeBuffer.writeUShort(packetIdentifier.toUShort())
    }

    companion object {
        fun from(buffer: ReadBuffer) = UnsubscribeAcknowledgment(buffer.readUnsignedShort().toInt())
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy