Documentation ¶
Index ¶
- Constants
- func CreateLiveConn(wsHostServer types.WsHostServer) (*websocket.Conn, error)
- func GetDanmuHostList(roomId int, cookie string) (*types.GetDanmuHostListResp, error)
- func LiveId2RoomId(liveId int) (int, error)
- func SendAuthMessage(ws *websocket.Conn, authMsg types.AuthMessage) error
- func SendHeartbeat(ws *websocket.Conn) error
- type Header
- type Message
Constants ¶
View Source
const ( OperationHeartbeat = 2 OperationHeartbeatReply = 3 OperationMessage = 5 OperationUserAuthentication = 7 OperationConnectSuccess = 8 PackageHeaderTotalLength = 16 PackageOffset = 0 HeaderOffset = 4 VersionOffset = 6 OperationOffset = 8 SequenceOffset = 12 BodyProtocolVersionNormal = 0 BodyProtocolDeflateVersion = 2 HeaderDefaultVersion = 1 HeaderDefaultOperation = 1 HeaderDefaultSequence = 1 AuthOk = 0 AuthTokenError = -101 )
Variables ¶
This section is empty.
Functions ¶
func CreateLiveConn ¶
func CreateLiveConn(wsHostServer types.WsHostServer) (*websocket.Conn, error)
func GetDanmuHostList ¶
func GetDanmuHostList(roomId int, cookie string) (*types.GetDanmuHostListResp, error)
func LiveId2RoomId ¶
func SendAuthMessage ¶
func SendAuthMessage(ws *websocket.Conn, authMsg types.AuthMessage) error
func SendHeartbeat ¶
Types ¶
type Header ¶
type Header struct { PackLength uint32 HeadLength uint16 Version uint16 Operation uint32 Sequence uint32 }
func PackHeader ¶
func UnpackHeader ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func PackMessage ¶
func UnpackMessage ¶
UnpackMessage 解析直播间消息 被压缩的消息是一组 Message, 所以解析完成会返回 []Message 而非 Message
Click to show internal directories.
Click to hide internal directories.