Documentation ¶
Index ¶
Constants ¶
View Source
const ( StartLive int = iota StopLive NewDanmu )
View Source
const ( GetUserInfoApi = "https://api.bilibili.com/x/space/acc/info" GetLiveRoomInfoApi = "https://api.live.bilibili.com/room/v1/Room/room_init" DefaultTimeout = 5 * time.Second )
View Source
const ( BiliLiveMsgApi = "wss://broadcastlv.chat.bilibili.com:2245/sub" HeartBeatInterval = 30 * time.Second MaxReconnection = 10 // ReadTimeout equals to HeartBeatInterval plus the time (10s) after which we consider a // read timeout since no heartbeat reply is received from server. ReadTimeout = HeartBeatInterval + 10*time.Second WriteTimeout = 10 * time.Second )
View Source
const ( HeaderLen = 16 MinJsonLen = 4 HeartBeatOp uint32 = 2 HeartBeatReplyOp uint32 = 3 NotificationOp uint32 = 5 // danmaku, broadcast, gift, etc. JoinOp uint32 = 7 JoinReplyOp uint32 = 8 JsonProcVer uint16 = 0 Uint32ProcVer uint16 = 1 ZippedProcVer uint16 = 2 NotificationDanmuCmd string = "DANMU_MSG" )
View Source
const ( // LiveRoom.LiveStatus NotStreaming = 0 Streaming = 1 )
View Source
const ModuleName = "bili"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DanmuEventData ¶
type DecodedLiveMsg ¶
type DecodedLiveMsg struct { Op uint32 Data interface{} }
type JoinRequestBody ¶
type LiveMsgFetcher ¶
type LiveMsgFetcher struct { UserInfo *UserInfo RoomID int64 // contains filtered or unexported fields }
func NewLiveMsgFetcher ¶
func NewLiveMsgFetcher(userInfo *UserInfo, eventChan chan *Event) *LiveMsgFetcher
func (*LiveMsgFetcher) Init ¶
func (f *LiveMsgFetcher) Init() error
func (*LiveMsgFetcher) Run ¶
func (f *LiveMsgFetcher) Run()
func (*LiveMsgFetcher) Stop ¶
func (f *LiveMsgFetcher) Stop()
type LiveMsgPacket ¶
type LiveMsgPacket struct { PacketLen uint32 HeaderLen uint16 ProcVer uint16 Op uint32 SeqID uint32 Body []byte }
func (*LiveMsgPacket) DecodeBodyAsNotificationRawJson ¶
func (p *LiveMsgPacket) DecodeBodyAsNotificationRawJson() ([]string, error)
func (*LiveMsgPacket) DecodeBodyAsViewCnt ¶
func (p *LiveMsgPacket) DecodeBodyAsViewCnt() (uint32, error)
func (*LiveMsgPacket) FromBytes ¶
func (p *LiveMsgPacket) FromBytes(buffer []byte) error
func (*LiveMsgPacket) ToBytes ¶
func (p *LiveMsgPacket) ToBytes() []byte
type NotificationBody ¶
type NotificationBody struct { Cmd string Data json.RawMessage Info []json.RawMessage // for DANMU_MSG }
func (*NotificationBody) ParseAsDanmu ¶
func (b *NotificationBody) ParseAsDanmu() (uname, content string, err error)
Click to show internal directories.
Click to hide internal directories.