relay

package
v0.0.0-...-1c5b680 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPeerSession = errors.New("Require valid lib.Session or lib.TCPConnector")
)

Functions

func Relay

func Relay(sesDetector interface{}, dataList ...interface{}) error

payload: msg/bytes passthrough: int64, []int64, string

func ResolveInboundEvent

func ResolveInboundEvent(inputEvent lib.Event) (outputEvent lib.Event, handled bool, err error)

func ResolveOutboundEvent

func ResolveOutboundEvent(inputEvent lib.Event) (handled bool, err error)

func SetBroadcaster

func SetBroadcaster(callback BroadcasterFunc)

设置广播函数, 回调时,按对应Peer/Session所在的队列中调用

Types

type BroadcasterFunc

type BroadcasterFunc func(event *RecvMsgEvent)

type PassthroughContent

type PassthroughContent struct {
	Int64      int64
	Int64Slice []int64
	Str        string
}

type RecvMsgEvent

type RecvMsgEvent struct {
	Ses lib.Session

	Msg interface{}
	// contains filtered or unexported fields
}

func (*RecvMsgEvent) Message

func (this *RecvMsgEvent) Message() interface{}

func (*RecvMsgEvent) PassThroughAsInt64

func (this *RecvMsgEvent) PassThroughAsInt64() int64

func (*RecvMsgEvent) PassThroughAsInt64Slice

func (this *RecvMsgEvent) PassThroughAsInt64Slice() []int64

func (*RecvMsgEvent) PassThroughAsString

func (this *RecvMsgEvent) PassThroughAsString() string

func (*RecvMsgEvent) Reply

func (this *RecvMsgEvent) Reply(msg interface{})

消息原路返回

func (*RecvMsgEvent) Session

func (this *RecvMsgEvent) Session() lib.Session

type RelayAck

type RelayAck struct {
	Msg                  []byte   `protobuf:"bytes,1,opt,name=Msg,proto3" json:"Msg,omitempty"`
	MsgId                int32    `protobuf:"varint,2,opt,name=MsgId,proto3" json:"MsgId,omitempty"`
	Bytes                []byte   `protobuf:"bytes,3,opt,name=Bytes,proto3" json:"Bytes,omitempty"`
	Int64                int64    `protobuf:"varint,4,opt,name=Int64,proto3" json:"Int64,omitempty"`
	Int64Slice           []int64  `protobuf:"varint,5,rep,packed,name=Int64Slice,proto3" json:"Int64Slice,omitempty"`
	Str                  string   `protobuf:"bytes,6,opt,name=Str,proto3" json:"Str,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RelayAck) Descriptor

func (*RelayAck) Descriptor() ([]byte, []int)

func (*RelayAck) GetBytes

func (m *RelayAck) GetBytes() []byte

func (*RelayAck) GetInt64

func (m *RelayAck) GetInt64() int64

func (*RelayAck) GetInt64Slice

func (m *RelayAck) GetInt64Slice() []int64

func (*RelayAck) GetMsg

func (m *RelayAck) GetMsg() []byte

func (*RelayAck) GetMsgId

func (m *RelayAck) GetMsgId() int32

func (*RelayAck) GetStr

func (m *RelayAck) GetStr() string

func (*RelayAck) ProtoMessage

func (*RelayAck) ProtoMessage()

func (*RelayAck) Reset

func (m *RelayAck) Reset()

func (*RelayAck) String

func (m *RelayAck) String() string

func (*RelayAck) XXX_DiscardUnknown

func (m *RelayAck) XXX_DiscardUnknown()

func (*RelayAck) XXX_Marshal

func (m *RelayAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RelayAck) XXX_Merge

func (m *RelayAck) XXX_Merge(src proto.Message)

func (*RelayAck) XXX_Size

func (m *RelayAck) XXX_Size() int

func (*RelayAck) XXX_Unmarshal

func (m *RelayAck) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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