Skip to content

Commit

Permalink
feat: recvPacket add size props
Browse files Browse the repository at this point in the history
  • Loading branch information
tangtaoit committed Mar 23, 2024
1 parent 7d854d5 commit b48dabd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ func (r *RecvPacket) GetFrameType() FrameType {
return RECV
}

func (r *RecvPacket) Size() int {
return r.SizeWithProtoVersion(LatestVersion)
}

func (r *RecvPacket) SizeWithProtoVersion(protVersion uint8) int {
return encodeRecvSize(r, protVersion)
}

// VerityString 验证字符串
func (r *RecvPacket) VerityString() string {
return fmt.Sprintf("%d%d%s%d%s%s%d%s", r.MessageID, r.MessageSeq, r.ClientMsgNo, r.Timestamp, r.FromUID, r.ChannelID, r.ChannelType, string(r.Payload))
Expand Down

0 comments on commit b48dabd

Please sign in to comment.