fastws

package module
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: BSD-3-Clause Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNew

func MustNew(opts ...Option) kit.Gateway

func New

func New(opts ...Option) (kit.Gateway, error)

func RPCs added in v0.10.40

func RPCs(predicate ...string) []kit.RouteSelector

RPCs is a shortcut for multiple RPC selectors

Types

type Option

type Option func(b *bundle)

func Listen

func Listen(protoAddr string) Option

func WithCustomRPC

func WithCustomRPC(in kit.IncomingRPCFactory, out kit.OutgoingRPCFactory) Option

WithCustomRPC lets you define your RPC message container. RPC message container will be represented as Envelope in your application. RPCContainer only defines the behavior of serialization and deserialization of the Envelope.

func WithLogger

func WithLogger(l kit.Logger) Option

func WithPredicateKey

func WithPredicateKey(key string) Option

func WithWebsocketBinaryMode added in v0.14.6

func WithWebsocketBinaryMode() Option

WithWebsocketBinaryMode sets the write mode of the websocket to binary opCode

func WithWebsocketTextMode added in v0.14.6

func WithWebsocketTextMode() Option

WithWebsocketTextMode sets the write mode of the websocket to text opCode This is the default behavior

type Selector

type Selector struct {
	Predicate string
	Encoding  kit.Encoding
}

func RPC

func RPC(predicate string) Selector

RPC returns a selector that acts on websocket messages

func (Selector) GetEncoding

func (r Selector) GetEncoding() kit.Encoding

func (Selector) GetPredicate

func (r Selector) GetPredicate() string

func (Selector) Query

func (r Selector) Query(q string) any

func (Selector) SetEncoding

func (r Selector) SetEncoding(enc kit.Encoding) Selector

type SwitchProtocol

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

func (*SwitchProtocol) Upgrade

func (sp *SwitchProtocol) Upgrade(conn io.ReadWriter) (hs ws.Handshake, err error)

Jump to

Keyboard shortcuts

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