Documentation
¶
Overview ¶
Package ws is partially based on the http package from go-kit. The code in this file is based on code from http package of go-kit project (https://github.com/go-kit/kit/blob/master/transport/http/intercepting_writer.go). All rights of the code belong to the original author.
Index ¶
- type Client
- type ClientOption
- func WithClientAfter(after ClientTunerFunc) ClientOption
- func WithClientBefore(before DiallerFunc) ClientOption
- func WithClientErrorHandler(handler transport.ErrorHandler) ClientOption
- func WithClientFinalizer(finalizer kithttp.ClientFinalizerFunc) ClientOption
- func WithClientPing(period, await time.Duration, pinging Pinging) ClientOption
- func WithClientReadTimeout(timeout time.Duration) ClientOption
- func WithClientWriteMod(mod WriteMod) ClientOption
- func WithClientWriteTimeout(timeout time.Duration) ClientOption
- type ClientTunerFunc
- type CloseCode
- type Closure
- type DecodeFunc
- type Dialler
- type DiallerFunc
- type EncodeFunc
- type MessageType
- type Pinging
- type Server
- type ServerOption
- func WithServerBefore(before UpgradeFunc) ServerOption
- func WithServerErrorHandler(handler transport.ErrorHandler) ServerOption
- func WithServerFinalizer(finalizer kithttp.ServerFinalizerFunc) ServerOption
- func WithServerPing(period, await time.Duration, pinging Pinging) ServerOption
- func WithServerReadTimeout(timeout time.Duration) ServerOption
- func WithServerWriteMod(mod WriteMod) ServerOption
- func WithServerWriteTimeout(timeout time.Duration) ServerOption
- type ServerTunerFunc
- type Tuner
- type UpgradeFunc
- type Upgrader
- type WriteMod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client[OUT, IN any] struct { // contains filtered or unexported fields }
func NewClient ¶
func NewClient[OUT, IN any]( url url.URL, enc EncodeFunc[OUT], dec DecodeFunc[IN], closure Closure, opts ...ClientOption, ) *Client[OUT, IN]
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
func WithClientAfter ¶
func WithClientAfter(after ClientTunerFunc) ClientOption
func WithClientBefore ¶
func WithClientBefore(before DiallerFunc) ClientOption
func WithClientErrorHandler ¶
func WithClientErrorHandler(handler transport.ErrorHandler) ClientOption
func WithClientFinalizer ¶
func WithClientFinalizer(finalizer kithttp.ClientFinalizerFunc) ClientOption
func WithClientPing ¶
func WithClientPing(period, await time.Duration, pinging Pinging) ClientOption
func WithClientReadTimeout ¶
func WithClientReadTimeout(timeout time.Duration) ClientOption
func WithClientWriteMod ¶
func WithClientWriteMod(mod WriteMod) ClientOption
func WithClientWriteTimeout ¶
func WithClientWriteTimeout(timeout time.Duration) ClientOption
type ClientTunerFunc ¶
type CloseCode ¶
type CloseCode int
const ( NormalClosureCloseCode CloseCode = websocket.CloseNormalClosure GoingAwayCloseCode CloseCode = websocket.CloseGoingAway ProtocolErrorCloseCode CloseCode = websocket.CloseProtocolError UnsupportedDataCloseCode CloseCode = websocket.CloseUnsupportedData NoStatusReceivedCloseCode CloseCode = websocket.CloseNoStatusReceived AbnormalClosureCloseCode CloseCode = websocket.CloseAbnormalClosure InvalidFramePayloadDataCloseCode CloseCode = websocket.CloseInvalidFramePayloadData PolicyViolationCloseCode CloseCode = websocket.ClosePolicyViolation MessageTooBigCloseCode CloseCode = websocket.CloseMessageTooBig MandatoryExtensionCloseCode CloseCode = websocket.CloseMandatoryExtension InternalServerErrCloseCode CloseCode = websocket.CloseInternalServerErr ServiceRestartCloseCode CloseCode = websocket.CloseServiceRestart TryAgainLaterCloseCode CloseCode = websocket.CloseTryAgainLater TLSHandshakeCloseCode CloseCode = websocket.CloseTLSHandshake )
type DecodeFunc ¶
type Dialler ¶
type Dialler interface { SetNetDial(dial func(network, addr string) (net.Conn, error)) SetNetDialContext(func(ctx context.Context, network, addr string) (net.Conn, error)) SetNetDialTLSContext(func(ctx context.Context, network, addr string) (net.Conn, error)) SetProxy(func(*http.Request) (*url.URL, error)) SetTLSClientConfig(*tls.Config) SetHandshakeTimeout(time.Duration) SetReadBufferSize(int) SetWriteBufferSize(int) SetWriteBufferPool(websocket.BufferPool) SetSubprotocols([]string) SetEnableCompression(bool) SetJar(http.CookieJar) }
type EncodeFunc ¶
type MessageType ¶
type MessageType int
const ( TextMessageType MessageType = websocket.TextMessage BinaryMessageType MessageType = websocket.BinaryMessage )
func (MessageType) String ¶
func (mt MessageType) String() string
type Server ¶
type Server[IN, OUT any] struct { // contains filtered or unexported fields }
func NewServer ¶
func NewServer[IN, OUT any]( e endpoint.BiStream[IN, OUT], dec DecodeFunc[IN], enc EncodeFunc[OUT], closure Closure, opts ...ServerOption, ) *Server[IN, OUT]
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
func WithServerBefore ¶
func WithServerBefore(before UpgradeFunc) ServerOption
func WithServerErrorHandler ¶
func WithServerErrorHandler(handler transport.ErrorHandler) ServerOption
func WithServerFinalizer ¶
func WithServerFinalizer(finalizer kithttp.ServerFinalizerFunc) ServerOption
func WithServerPing ¶
func WithServerPing(period, await time.Duration, pinging Pinging) ServerOption
func WithServerReadTimeout ¶
func WithServerReadTimeout(timeout time.Duration) ServerOption
func WithServerWriteMod ¶
func WithServerWriteMod(mod WriteMod) ServerOption
func WithServerWriteTimeout ¶
func WithServerWriteTimeout(timeout time.Duration) ServerOption
type UpgradeFunc ¶
type Upgrader ¶
type Upgrader interface { SetHandshakeTimeout(timeout time.Duration) SetReadBufferSize(size int) SetWriteBufferSize(size int) SetWriteBufferPool(pool websocket.BufferPool) SetSubprotocols(protocols []string) SetErrorWriter(writer func(w http.ResponseWriter, r *http.Request, status int, reason error)) SetCheckOrigin(check func(r *http.Request) bool) SetEnableCompression(enabled bool) }
Click to show internal directories.
Click to hide internal directories.