Add keepaliveAckPacket
1 files changed, 6 insertions(+), 1 deletions(-)

M packet.go
M packet.go +6 -1
@@ 11,6 11,7 @@ const (
 	closePacket
 	halfClosePacket
 	keepalivePacket
+	keepaliveAckPacket
 )
 
 type Packet struct {

          
@@ 39,7 40,11 @@ func (packet *Packet) Type() int {
 	var h = packet.header
 	switch {
 	case h.ConnectionId == 0:
-		return keepalivePacket
+		if bytes.Equal(packet.Payload, []byte{'a'}) {
+			return keepaliveAckPacket
+		} else {
+			return keepalivePacket
+		}
 	case h.Control == 1:
 		if bytes.Equal(packet.Payload, []byte{'r'}) {
 			return halfClosePacket