client

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSG_TYPE_DATA           = 0
	MSG_TYPE_WS_CONNECT     = 1
	MSG_TYPE_WS_DISCONNECT  = 2
	MSG_TYPE_ROOM_CONN_FAIL = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewBRelayClient

func NewBRelayClient(name, network, address string, dial dialer.DialFunc, ich chan struct{}) *Client

func (*Client) Login

func (c *Client) Login() (*toyframe.Context, error)

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) ReadBodyBytes

func (c *Client) ReadBodyBytes(data []byte, body_key string) []byte

func (*Client) ReadMessages

func (c *Client) ReadMessages(ctx *toyframe.Context) ([]MsgSubscribeData, error)

func (*Client) Subscribe

func (c *Client) Subscribe(rooms []MsgSubscribeRoom) error

type MsgLoginReq

type MsgLoginReq struct {
	ID string `msg:"id"`
}

func (*MsgLoginReq) DecodeMsg

func (z *MsgLoginReq) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (MsgLoginReq) EncodeMsg

func (z MsgLoginReq) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (MsgLoginReq) MarshalMsg

func (z MsgLoginReq) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MsgLoginReq) Msgsize

func (z MsgLoginReq) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgLoginReq) UnmarshalMsg

func (z *MsgLoginReq) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgLoginRsp

type MsgLoginRsp struct {
	SubscriberID     uint32 `msg:"sid"`
	SubscriberSecret []byte `msg:"sec"`
}

func (*MsgLoginRsp) DecodeMsg

func (z *MsgLoginRsp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*MsgLoginRsp) EncodeMsg

func (z *MsgLoginRsp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MsgLoginRsp) MarshalMsg

func (z *MsgLoginRsp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MsgLoginRsp) Msgsize

func (z *MsgLoginRsp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgLoginRsp) UnmarshalMsg

func (z *MsgLoginRsp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgLogoutReq

type MsgLogoutReq struct {
	SubscriberID     uint32 `msg:"sid"`
	SubscriberSecret []byte `msg:"sec"`
}

func (*MsgLogoutReq) DecodeMsg

func (z *MsgLogoutReq) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*MsgLogoutReq) EncodeMsg

func (z *MsgLogoutReq) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MsgLogoutReq) MarshalMsg

func (z *MsgLogoutReq) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MsgLogoutReq) Msgsize

func (z *MsgLogoutReq) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgLogoutReq) UnmarshalMsg

func (z *MsgLogoutReq) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgLogoutRsp

type MsgLogoutRsp struct {
	Ok  bool   `msg:"ok"`
	Msg string `msg:"msg"`
}

func (*MsgLogoutRsp) DecodeMsg

func (z *MsgLogoutRsp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (MsgLogoutRsp) EncodeMsg

func (z MsgLogoutRsp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (MsgLogoutRsp) MarshalMsg

func (z MsgLogoutRsp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MsgLogoutRsp) Msgsize

func (z MsgLogoutRsp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgLogoutRsp) UnmarshalMsg

func (z *MsgLogoutRsp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgSubscribeBatch

type MsgSubscribeBatch struct {
	Msgs []MsgSubscribeData `msg:"msgs"`
}

func (*MsgSubscribeBatch) Clone

func (*MsgSubscribeBatch) CombineWith

func (b *MsgSubscribeBatch) CombineWith(other *MsgSubscribeBatch)

func (*MsgSubscribeBatch) DecodeMsg

func (z *MsgSubscribeBatch) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*MsgSubscribeBatch) EncodeMsg

func (z *MsgSubscribeBatch) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MsgSubscribeBatch) MarshalMsg

func (z *MsgSubscribeBatch) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MsgSubscribeBatch) Msgsize

func (z *MsgSubscribeBatch) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgSubscribeBatch) UnmarshalMsg

func (z *MsgSubscribeBatch) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgSubscribeData

type MsgSubscribeData struct {
	RoomID  int    `msg:"room"`
	MsgType byte   `msg:"type"`
	Cmd     string `msg:"cmd"`
	Data    []byte `msg:"data"`
}

func (*MsgSubscribeData) DecodeMsg

func (z *MsgSubscribeData) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*MsgSubscribeData) EncodeMsg

func (z *MsgSubscribeData) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MsgSubscribeData) MarshalMsg

func (z *MsgSubscribeData) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MsgSubscribeData) Msgsize

func (z *MsgSubscribeData) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgSubscribeData) UnmarshalMsg

func (z *MsgSubscribeData) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgSubscribeReq

type MsgSubscribeReq struct {
	SubscriberID     uint32             `msg:"sid"`
	SubscriberSecret []byte             `msg:"sec"`
	Rooms            []MsgSubscribeRoom `msg:"rooms"`
}

func (*MsgSubscribeReq) DecodeMsg

func (z *MsgSubscribeReq) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*MsgSubscribeReq) EncodeMsg

func (z *MsgSubscribeReq) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MsgSubscribeReq) MarshalMsg

func (z *MsgSubscribeReq) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MsgSubscribeReq) Msgsize

func (z *MsgSubscribeReq) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgSubscribeReq) UnmarshalMsg

func (z *MsgSubscribeReq) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgSubscribeRoom

type MsgSubscribeRoom struct {
	RoomID int      `msg:"room"`
	Cmds   []string `msg:"cmds"`
}

func (*MsgSubscribeRoom) DecodeMsg

func (z *MsgSubscribeRoom) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*MsgSubscribeRoom) EncodeMsg

func (z *MsgSubscribeRoom) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MsgSubscribeRoom) MarshalMsg

func (z *MsgSubscribeRoom) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*MsgSubscribeRoom) Msgsize

func (z *MsgSubscribeRoom) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgSubscribeRoom) UnmarshalMsg

func (z *MsgSubscribeRoom) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MsgSubscribeRsp

type MsgSubscribeRsp struct {
	Ok  bool   `msg:"ok"`
	Msg string `msg:"msg"`
}

func (*MsgSubscribeRsp) DecodeMsg

func (z *MsgSubscribeRsp) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (MsgSubscribeRsp) EncodeMsg

func (z MsgSubscribeRsp) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (MsgSubscribeRsp) MarshalMsg

func (z MsgSubscribeRsp) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MsgSubscribeRsp) Msgsize

func (z MsgSubscribeRsp) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*MsgSubscribeRsp) UnmarshalMsg

func (z *MsgSubscribeRsp) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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