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
575 B
23 lines
575 B
package session |
|
|
|
import "github.com/bytedance/sonic" |
|
|
|
// GateSubject 消息传递主体 |
|
type GateSubject 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 *GateSubject) MarshalBinary() (data []byte, err error) { |
|
bytes, err := sonic.Marshal(sub) |
|
if err != nil { |
|
return nil, err |
|
} |
|
return bytes, nil |
|
} |
|
|
|
func (sub *GateSubject) UnmarshalBinary(data []byte) error { |
|
return sonic.Unmarshal(data, sub) |
|
}
|
|
|