Documentation ¶
Index ¶
- Constants
- Variables
- type Endpoint
- func (endpoint *Endpoint) Addr() net.Addr
- func (endpoint *Endpoint) Close() error
- func (endpoint *Endpoint) DispatchInterrupt(receiver []byte, msg rpc.Interrupt) error
- func (endpoint *Endpoint) DispatchProgress(msg rpc.Progress) error
- func (endpoint *Endpoint) DispatchReply(msg rpc.Reply) error
- func (endpoint *Endpoint) DispatchRequest(receiver []byte, msg rpc.Request) error
- func (endpoint *Endpoint) DispatchStreamFrame(msg rpc.StreamFrame) error
- func (endpoint *Endpoint) ListenAndServe() (err error)
- type EndpointConfig
- type ErrUnknownReceiver
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) DispatchInterrupt ¶
func (*Endpoint) DispatchProgress ¶
func (*Endpoint) DispatchRequest ¶
func (*Endpoint) DispatchStreamFrame ¶
func (endpoint *Endpoint) DispatchStreamFrame(msg rpc.StreamFrame) error
func (*Endpoint) ListenAndServe ¶
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
Click to show internal directories.
Click to hide internal directories.