BroadcastCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const BroadcastCmd uint16 = 113
BroadcastVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const BroadcastVer uint8 = 1
CreateCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const CreateCmd uint16 = 110
CreateVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const CreateVer uint8 = 1
JoinCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const JoinCmd uint16 = 111
JoinVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const JoinVer uint8 = 1
LeaveCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const LeaveCmd uint16 = 112
LeaveVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const LeaveVer uint8 = 1
Broadcast represents the command protocol data structure.
type Broadcast struct {
// Command version of the protocol
Ver uint8
// Command ID of the protocol
Cmd uint16
// group ID
GroupID string
// Message to be sent as the broadcast
Message []byte
// If true, UDP will become RUDP
Reliable bool
}
func NewBroadcast() *Broadcast
NewBroadcast creates a new instance of Broadcast struct.
func (proto *Broadcast) GetCmd() uint16
func (proto *Broadcast) GetVer() uint8
func (proto *Broadcast) Pack() []byte
Pack encodes Broadcast struct to a byte array to be delivered over the command.
func (proto *Broadcast) String() string
func (proto *Broadcast) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Broadcast struct.
Create represents the command protocol data structure.
type Create struct {
// Command version of the protocol
Ver uint8
// Command ID of the protocol
Cmd uint16
// If true, the group will not be deleted until TTL expires even if all members leave
AllowEmpty bool
// If true, the creator user will join the group automatically
Join bool
// TTL of the group in seconds
Ttl uint16
}
func NewCreate() *Create
NewCreate creates a new instance of Create struct.
func (proto *Create) GetCmd() uint16
func (proto *Create) GetVer() uint8
func (proto *Create) Pack() []byte
Pack encodes Create struct to a byte array to be delivered over the command.
func (proto *Create) String() string
func (proto *Create) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Create struct.
Join represents the command protocol data structure.
type Join struct {
// Command version of the protocol
Ver uint8
// Command ID of the protocol
Cmd uint16
// group ID
GroupID string
// Message to be sent when join is successful.
Message []byte
}
func NewJoin() *Join
NewJoin creates a new instance of Join struct.
func (proto *Join) GetCmd() uint16
func (proto *Join) GetVer() uint8
func (proto *Join) Pack() []byte
Pack encodes Join struct to a byte array to be delivered over the command.
func (proto *Join) String() string
func (proto *Join) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Join struct.
Leave represents the command protocol data structure.
type Leave struct {
// Command version of the protocol
Ver uint8
// Command ID of the protocol
Cmd uint16
// group ID
GroupID string
// Message to be sent when leave is successful.
Message []byte
}
func NewLeave() *Leave
NewLeave creates a new instance of Leave struct.
func (proto *Leave) GetCmd() uint16
func (proto *Leave) GetVer() uint8
func (proto *Leave) Pack() []byte
Pack encodes Leave struct to a byte array to be delivered over the command.
func (proto *Leave) String() string
func (proto *Leave) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Leave struct.