Documentation
¶
Index ¶
- type Blackbox
- type Client
- type ClientOption
- type ClientOptions
- type DefaultTool
- func (d *DefaultTool) AcceptWebSocket(ctx context.Context, opts contract.AcceptWebSocketOptions) (*contract.WebSocketConn, error)
- func (d *DefaultTool) CloseWebSocket(ctx context.Context, opts contract.CloseWebSocketOptions) error
- func (d *DefaultTool) DialWebSocket(ctx context.Context, opts contract.DialWebSocketOptions) (*contract.WebSocketConn, *http.Response, error)
- func (d *DefaultTool) FormatWebSocketCloseMessage(ctx context.Context, opts contract.FormatWebSocketCloseMessageOptions) ([]byte, error)
- func (d *DefaultTool) IsUnexpectedWebSocketCloseError(ctx context.Context, opts contract.IsUnexpectedWebSocketCloseErrorOptions) (bool, error)
- func (d *DefaultTool) ReadWebSocket(ctx context.Context, opts contract.ReadWebSocketOptions) (*contract.WebSocketBytesMessage, error)
- func (d *DefaultTool) ReaderWebSocket(ctx context.Context, opts contract.ReaderWebSocketOptions) (*contract.WebSocketReaderMessage, error)
- func (d *DefaultTool) SetWebSocketPongHandler(ctx context.Context, opts contract.SetWebSocketPongHandlerOptions) error
- func (d *DefaultTool) SetWebSocketReadDeadline(ctx context.Context, opts contract.SetWebSocketReadDeadlineOptions) error
- func (d *DefaultTool) WriteWebSocket(ctx context.Context, opts contract.WriteWebSocketOptions) error
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Blackbox
contract.WebSocketOperator
}
func NewClient ¶
func NewClient(opts ClientOptions) (Client, error)
type ClientOption ¶
type ClientOption = contract.Opt[ClientOptions]
func WithReadBufferSize ¶
func WithReadBufferSize(x int) ClientOption
func WithReadLimit ¶
func WithReadLimit(x int64) ClientOption
func WithWriteBufferSize ¶
func WithWriteBufferSize(x int) ClientOption
type ClientOptions ¶
func ApplyClientOptions ¶
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type DefaultTool ¶
func NewTool ¶
func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) AcceptWebSocket ¶
func (d *DefaultTool) AcceptWebSocket(ctx context.Context, opts contract.AcceptWebSocketOptions) (*contract.WebSocketConn, error)
AcceptWebSocket upgrades an HTTP request to a websocket connection.
func (*DefaultTool) CloseWebSocket ¶
func (d *DefaultTool) CloseWebSocket(ctx context.Context, opts contract.CloseWebSocketOptions) error
CloseWebSocket closes a websocket connection.
func (*DefaultTool) DialWebSocket ¶
func (d *DefaultTool) DialWebSocket(ctx context.Context, opts contract.DialWebSocketOptions) (*contract.WebSocketConn, *http.Response, error)
DialWebSocket dials a websocket server and returns the websocket connection and HTTP response.
func (*DefaultTool) FormatWebSocketCloseMessage ¶
func (d *DefaultTool) FormatWebSocketCloseMessage(ctx context.Context, opts contract.FormatWebSocketCloseMessageOptions) ([]byte, error)
FormatWebSocketCloseMessage formats a websocket close message.
func (*DefaultTool) IsUnexpectedWebSocketCloseError ¶
func (d *DefaultTool) IsUnexpectedWebSocketCloseError(ctx context.Context, opts contract.IsUnexpectedWebSocketCloseErrorOptions) (bool, error)
IsUnexpectedWebSocketCloseError checks if an error is an unexpected websocket close error.
func (*DefaultTool) ReadWebSocket ¶
func (d *DefaultTool) ReadWebSocket(ctx context.Context, opts contract.ReadWebSocketOptions) (*contract.WebSocketBytesMessage, error)
ReadWebSocket reads a websocket message and returns it as bytes.
func (*DefaultTool) ReaderWebSocket ¶
func (d *DefaultTool) ReaderWebSocket(ctx context.Context, opts contract.ReaderWebSocketOptions) (*contract.WebSocketReaderMessage, error)
ReaderWebSocket reads a websocket message and returns it as a reader.
func (*DefaultTool) SetWebSocketPongHandler ¶
func (d *DefaultTool) SetWebSocketPongHandler(ctx context.Context, opts contract.SetWebSocketPongHandlerOptions) error
SetWebSocketPongHandler sets the pong handler on a websocket connection.
func (*DefaultTool) SetWebSocketReadDeadline ¶
func (d *DefaultTool) SetWebSocketReadDeadline(ctx context.Context, opts contract.SetWebSocketReadDeadlineOptions) error
SetWebSocketReadDeadline sets the read deadline on a websocket connection.
func (*DefaultTool) WriteWebSocket ¶
func (d *DefaultTool) WriteWebSocket(ctx context.Context, opts contract.WriteWebSocketOptions) error
WriteWebSocket writes a websocket message.
type Tool ¶
type Tool interface {
contract.WebSocketOperator
}