live

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthFailed = errors.New("auth failed")
View Source
var ErrMsgPackedWrong = errors.New("msg packed wrong")

Functions

func Unpack

func Unpack(ch chan<- Msg, data []byte) (err error)

Types

type Msg

type Msg = cmd.Cmd[json.RawMessage]

type MsgVersion

type MsgVersion uint16 // Msg Version
const (
	MsgV0 MsgVersion = iota // 0 如果Version=0,Body中就是实际发送的数据。

	MsgV2 // 2 如果Version=2,Body中是经过压缩后的数据,请使用zlib解压,然后按照Proto协议去解析
)

type Op

type Op uint32
const (
	OpHeartbeat      Op = 2 + iota // 2 客户端发送的心跳包(30秒发送一次)
	OpHeartbeatReply               // 3 服务器收到心跳包的回复

	OpSmsSendReply // 5 服务器推送的弹幕消息包

	OpAuth      // 7 客户端发送的鉴权包(客户端发送的第一个包)
	OpAuthReply // 8 服务器收到鉴权包后的回复
)

type PacketHeader

type PacketHeader [16]byte

func NewPacketHeader

func NewPacketHeader(op Op, v MsgVersion, end uint32) (ph PacketHeader)

func (PacketHeader) End

func (ph PacketHeader) End() uint32

func (PacketHeader) Operation

func (ph PacketHeader) Operation() Op

func (PacketHeader) Version

func (ph PacketHeader) Version() MsgVersion

type Room

type Room struct {
	WSDialOptioins *websocket.DialOptions
	// contains filtered or unexported fields
}

func RoomWith

func RoomWith(info bilibili.WebsocketInfo) *Room

func (*Room) Connect

func (room *Room) Connect(ctx context.Context) (_ <-chan Msg, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL