You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
559 B

package session
import "github.com/bytedance/sonic"
// Subject 消息传递主体
type Subject struct {
Uid string `json:"uid,omitempty"`
Online int8 `json:"online,omitempty"` // 0离线,1在线
Time int64 `json:"time,omitempty"`
Gate string `json:"gate,omitempty"` // 连接的网关addr
}
func (sub *Subject) MarshalBinary() (data []byte, err error) {
bytes, err := sonic.Marshal(sub)
if err != nil {
return nil, err
}
return bytes, nil
}
func (sub *Subject) UnmarshalBinary(data []byte) error {
return sonic.Unmarshal(data, sub)
}