websocket

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package websocket provides WebSocket upstream integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUpstream

func NewUpstream(poolManager *pool.Manager) upstream.Upstream

NewUpstream creates a new instance of WebsocketUpstream.

poolManager is the connection pool manager to be used for managing WebSocket connections.

Types

type Pool

Pool is a type alias for a pool of WebSocket client connections. It simplifies the type signature for WebSocket connection pools.

func NewPool

func NewPool(maxSize int, idleTimeout time.Duration, address string) (Pool, error)

NewPool creates a new connection pool for WebSocket clients. It configures the pool with a factory function that establishes new WebSocket connections to the specified address.

maxSize is the maximum number of connections the pool can hold. idleTimeout is the duration after which an idle connection may be closed. address is the target URL of the WebSocket server. It returns a new WebSocket client pool or an error if the pool cannot be created.

type Upstream

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

Upstream implements the upstream.Upstream interface for services that are exposed via a WebSocket connection. It manages a connection pool and registers tools based on the service configuration.

func (*Upstream) Register

func (u *Upstream) Register(
	ctx context.Context,
	serviceConfig *configv1.UpstreamServiceConfig,
	toolManager tool.ManagerInterface,
	promptManager prompt.ManagerInterface,
	resourceManager resource.ManagerInterface,
	isReload bool,
) (string, []*configv1.ToolDefinition, []*configv1.ResourceDefinition, error)

Register processes the configuration for a WebSocket service. It creates a connection pool and registers tools for each call definition specified in the configuration.

func (*Upstream) Shutdown

func (u *Upstream) Shutdown(_ context.Context) error

Shutdown gracefully terminates the WebSocket upstream service by shutting down the associated connection pool.

Jump to

Keyboard shortcuts

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