ws

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept

Accept accepts a WebSocket handshake from a client and upgrades the connection to a WebSocket.

Types

type Inbound

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

Inbound http(ws) type.

func NewInbound

func NewInbound(internalAddr, externalAddr, certFile, keyFile string, opts ...InboundOpt) (*Inbound, error)

NewInbound creates a new WebSocket inbound transport instance.

func (*Inbound) Endpoint

func (i *Inbound) Endpoint() string

Endpoint provides the http(ws) connection details.

func (*Inbound) Start

func (i *Inbound) Start(prov transport.Provider) error

Start the http(ws) server.

func (*Inbound) Stop

func (i *Inbound) Stop() error

Stop the http(ws) server.

type InboundOpt

type InboundOpt func(opts *inboundOpts)

InboundOpt is an inbound ws option.

func WithInboundReadLimit

func WithInboundReadLimit(n int64) InboundOpt

WithInboundReadLimit sets the custom max number of bytes to read for a single message.

type OutboundClient

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

OutboundClient websocket outbound.

func NewOutbound

func NewOutbound(opts ...OutboundClientOpt) *OutboundClient

NewOutbound creates a client for Outbound WS transport.

func (*OutboundClient) Accept

func (cs *OutboundClient) Accept(url string) bool

Accept checks for the url scheme.

func (*OutboundClient) AcceptRecipient

func (cs *OutboundClient) AcceptRecipient(keys []string) bool

AcceptRecipient checks if there is a connection for the list of recipient keys.

func (*OutboundClient) Send

func (cs *OutboundClient) Send(data []byte, destination *service.Destination) (string, error)

Send sends a2a data via WS.

func (*OutboundClient) Start

func (cs *OutboundClient) Start(prov transport.Provider) error

Start starts the outbound transport.

type OutboundClientOpt

type OutboundClientOpt func(c *OutboundClient)

OutboundClientOpt configures outbound client.

func WithOutboundReadLimit

func WithOutboundReadLimit(n int64) OutboundClientOpt

WithOutboundReadLimit sets the custom max number of bytes to read for a single message.

Jump to

Keyboard shortcuts

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