Documentation ¶
Index ¶
- Variables
- type Channel
- func (ch *Channel) Context() context.Context
- func (ch *Channel) Recv(obj interface{}) (bool, error)
- func (ch *Channel) Send(obj interface{}, more bool) error
- func (ch *Channel) SendErr(code int, message string, data interface{}) error
- func (ch *Channel) SendLast(obj interface{}) error
- func (ch *Channel) SetExt(ext interface{})
- type Codec
- type Error
- type Message
- type Peer
- type RPC
- func (rpc *RPC) Accept(conn io.ReadWriteCloser) (*Peer, error)
- func (rpc *RPC) AcceptWith(conn io.ReadWriteCloser, ctx context.Context) (*Peer, error)
- func (rpc *RPC) CallbackFunc(fn func(interface{}, *Channel) (interface{}, error)) string
- func (rpc *RPC) Handshake(conn io.ReadWriteCloser) (*Peer, error)
- func (rpc *RPC) Register(name string, handler func(*Channel) error)
- func (rpc *RPC) RegisterFunc(name string, fn func(interface{}, *Channel) (interface{}, error))
- func (rpc *RPC) Unregister(name string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Version = "0.1.0" ProtocolName = "SIMPLEX" ProtocolVersion = "1.0" TypeRequest = "req" TypeReply = "rep" HandshakeAccept = "+OK" BacklogSize = 1024 MaxFrameSize = 1 << 20 // 1mb )
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { *Peer // contains filtered or unexported fields }
type Codec ¶
type Codec struct { Name string Encode func(obj interface{}) ([]byte, error) Decode func(frame []byte, obj interface{}) error }
func NewJSONCodec ¶
func NewJSONCodec() *Codec
type Error ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) CloseNotify ¶
type RPC ¶
func (*RPC) AcceptWith ¶
func (*RPC) CallbackFunc ¶
func (*RPC) RegisterFunc ¶
func (*RPC) Unregister ¶
Click to show internal directories.
Click to hide internal directories.