rpc

package
v0.0.0-...-ff27e19 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2014 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeRegister byte = iota
	MessageTypeUnregister
	MessageTypeRequest
	MessageTypeInterrupt
	MessageTypeProgress
	MessageTypeStreamFrame
	MessageTypeReply
	MessageTypePing
	MessageTypePong
)
View Source
const IdentityHeader = "X-Meeko-Identity"
View Source
const Protocol = "CDR#RPC@01"

Variables

View Source
var (
	FrameEmpty  = []byte{}
	FrameHeader = []byte(Protocol)

	FrameRegisterMT    = []byte{MessageTypeRegister}
	FrameUnregisterMT  = []byte{MessageTypeUnregister}
	FrameRequestMT     = []byte{MessageTypeRequest}
	FrameInterruptMT   = []byte{MessageTypeInterrupt}
	FrameProgressMT    = []byte{MessageTypeProgress}
	FrameStreamFrameMT = []byte{MessageTypeStreamFrame}
	FrameReplyMT       = []byte{MessageTypeReply}
	FramePingMT        = []byte{MessageTypePing}
	FramePongMT        = []byte{MessageTypePong}
)
View Source
var (
	ErrTlsAlreadyConfigured    = errors.New("TLS for WebSocket is already configured")
	ErrAddrNotSet              = errors.New("WebSocket endpoint network address is not set")
	ErrNegativeHeartbeatPeriod = errors.New("WebSocket endpoint heartbeat period is negative")
	ErrTerminated              = errors.New("WebSocket endpoint already terminated")
)

Functions

This section is empty.

Types

type Endpoint

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

func NewEndpoint

func NewEndpoint(config *EndpointConfig, exchange rpc.Exchange) (*Endpoint, error)

func (*Endpoint) Addr

func (endpoint *Endpoint) Addr() net.Addr

func (*Endpoint) Close

func (endpoint *Endpoint) Close() error

func (*Endpoint) DispatchInterrupt

func (endpoint *Endpoint) DispatchInterrupt(receiver []byte, msg rpc.Interrupt) error

func (*Endpoint) DispatchProgress

func (endpoint *Endpoint) DispatchProgress(msg rpc.Progress) error

func (*Endpoint) DispatchReply

func (endpoint *Endpoint) DispatchReply(msg rpc.Reply) error

func (*Endpoint) DispatchRequest

func (endpoint *Endpoint) DispatchRequest(receiver []byte, msg rpc.Request) error

func (*Endpoint) DispatchStreamFrame

func (endpoint *Endpoint) DispatchStreamFrame(msg rpc.StreamFrame) error

func (*Endpoint) ListenAndServe

func (endpoint *Endpoint) ListenAndServe() (err error)

type EndpointConfig

type EndpointConfig struct {
	// Addr is the TCP network address the new endpoint should listen on.
	// This is the minimal configuration that is required.
	Addr string

	// WSConfig is optional and can be used to specify WebSocket config in
	// more details, e.g. it can be used to configure TLS.
	WSConfig ws.Config

	// WSHandshake is an optional function in WebSocket handshake.
	// For example it can be used to authenticate or authorize the
	// connection.
	//
	// It is the same function as ws.Server.Handshake. You can check the
	// documentation there for more details.
	WSHandshake func(*ws.Config, *http.Request) error

	// Heartbeat message is sent over the connection every HeartbeatPeriod.
	// Leaving this value set to zero means that heartbeat is disabled.
	HeartbeatPeriod time.Duration
}

func NewEndpointConfig

func NewEndpointConfig() *EndpointConfig

func (*EndpointConfig) FeedFromEnv

func (config *EndpointConfig) FeedFromEnv(prefix string) error

func (*EndpointConfig) IsComplete

func (config *EndpointConfig) IsComplete() error

func (*EndpointConfig) MustBeComplete

func (config *EndpointConfig) MustBeComplete() *EndpointConfig

func (*EndpointConfig) MustFeedFromEnv

func (config *EndpointConfig) MustFeedFromEnv(prefix string) *EndpointConfig

type ErrUnknownReceiver

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

func (*ErrUnknownReceiver) Error

func (err *ErrUnknownReceiver) Error() string

Jump to

Keyboard shortcuts

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