Documentation
¶
Index ¶
- type Client
- type Handler
- type HandlerCallback
- func (h *HandlerCallback) OnClose(client *Client, id string)
- func (h *HandlerCallback) OnConnect(client *Client, url string)
- func (h *HandlerCallback) OnData(client *Client, id string, data []byte)
- func (h *HandlerCallback) OnError(client *Client, err error)
- func (h *HandlerCallback) OnHeader(client *Client, id string, headers map[string]string)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Close ¶
func (c *Client) Close()
Close closes the bridge client and disconnects from the bridge server
type Handler ¶
type Handler interface {
// OnConnect is called when the bridge client is connected to the bridge server
OnConnect(client *Client, url string)
// OnHeader is called when a header is received from the bridge. this will only be called once before any data is sent.
OnHeader(client *Client, id string, headers map[string]string)
// OnData is called when a data is received from the bridge. this will be called multiple times if the data is large.
OnData(client *Client, id string, data []byte)
// OnClose is called when the bridge request is completed and no more data will be sent
OnClose(client *Client, id string)
// OnError is called when an error occurs at any point in the bridge client
OnError(client *Client, err error)
}
Handler is an interface that defines the callback methods for a bridge handler to implement
type HandlerCallback ¶
type HandlerCallback struct {
OnConnectFunc func(client *Client, url string)
OnHeaderFunc func(client *Client, id string, headers map[string]string)
OnDataFunc func(client *Client, id string, data []byte)
OnCloseFunc func(client *Client, id string)
OnErrorFunc func(client *Client, err error)
}
HandlerCallback is a struct that implements the BridgeHandler interface
func (*HandlerCallback) OnClose ¶
func (h *HandlerCallback) OnClose(client *Client, id string)
func (*HandlerCallback) OnConnect ¶
func (h *HandlerCallback) OnConnect(client *Client, url string)
func (*HandlerCallback) OnData ¶
func (h *HandlerCallback) OnData(client *Client, id string, data []byte)
func (*HandlerCallback) OnError ¶
func (h *HandlerCallback) OnError(client *Client, err error)
type Options ¶
type Options struct {
// Context is the context for the bridge client (optional)
Context context.Context
// Logger is the logger for the bridge client (optional)
Logger logger.Logger
// URL is the URL of the bridge (optional)
URL string
// APIKey is the API key for the bridge (optional, will use AGENTUITY_API_KEY environment variable if not set)
APIKey string
// Handler is the handler for the bridge client (required)
Handler Handler
}
Click to show internal directories.
Click to hide internal directories.