Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v2.30.5 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeUnknown         = common.MessageTypeUnknown
	MessageTypeData            = common.MessageTypeData
	MessageTypeError           = common.MessageTypeError
	MessageTypeComplete        = common.MessageTypeComplete
	MessageTypeConnectionError = common.MessageTypeConnectionError

	TransportWS  = common.TransportWS
	TransportSSE = common.TransportSSE

	SubprotocolAuto               = common.SubprotocolAuto
	SubprotocolGraphQLTransportWS = common.SubprotocolGraphQLTransportWS
	SubprotocolGraphQLWS          = common.SubprotocolGraphQLWS

	SSEMethodPOST = common.SSEMethodPOST
	SSEMethodGET  = common.SSEMethodGET
)

Variables

View Source
var (
	ErrConnectionClosed   = common.ErrConnectionClosed
	ErrConnectionError    = protocol.ErrConnectionError
	ErrAckTimeout         = protocol.ErrAckTimeout
	ErrAckNotReceived     = protocol.ErrAckNotReceived
	ErrSubscriptionExists = transport.ErrSubscriptionExists
	ErrDialFailed         = transport.ErrDialFailed
	ErrInitFailed         = transport.ErrInitFailed
)
View Source
var ErrClientClosed = errors.New("client closed")

ErrClientClosed is returned when Subscribe is called after the client's context has been canceled.

Functions

This section is empty.

Types

type Client

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

func New

func New(ctx context.Context, cfg Config) *Client

New creates a new subscription client with the provided config.

func (*Client) Stats

func (c *Client) Stats() Stats

Stats returns client statistics.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, req *common.Request, opts common.Options, handler common.Handler) (func(), error)

Subscribe creates a new upstream via the appropriate transport.

type Config

type Config struct {
	UpgradeClient   *http.Client
	StreamingClient *http.Client
	Logger          abstractlogger.Logger
	PingInterval    time.Duration
	PingTimeout     time.Duration
	AckTimeout      time.Duration
	WriteTimeout    time.Duration
	ReadLimit       int64
	WSIdleTimeout   time.Duration
}

Config holds the client configuration.

type ErrFailedSubscriptionConnection added in v2.21.1

type ErrFailedSubscriptionConnection = transport.ErrFailedSubscriptionConnection

type ErrInvalidSubprotocol

type ErrInvalidSubprotocol = transport.ErrInvalidSubprotocol

type ExecutionResult

type ExecutionResult = common.ExecutionResult

type Handler

type Handler = common.Handler

type Message

type Message = common.Message

type MessageType

type MessageType = common.MessageType

type Options

type Options = common.Options

type Request

type Request = common.Request

type SSEMethod

type SSEMethod = common.SSEMethod

type Stats

type Stats struct {
	WSConns  int // active WebSocket connections
	SSEConns int // active SSE connections
}

Stats contains client statistics.

type TransportType

type TransportType = common.TransportType

type WSSubprotocol

type WSSubprotocol = common.WSSubprotocol

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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