legacy

package
v0.38.0-preview.0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SubscribeHandlerFunc

type SubscribeHandlerFunc func(
	ctx context.Context,
	request *common.Request,
	wsController *WebsocketController,
) (subscription.Subscription, error)

SubscribeHandlerFunc is a function that contains endpoint handling logic for subscribes, fetches necessary resources

type WSHandler

type WSHandler struct {
	*common.HttpHandler
	// contains filtered or unexported fields
}

WSHandler is websocket handler implementing custom websocket handler function and allows easier handling of errors and responses as it wraps functionality for handling error and responses outside of endpoint handling.

func NewWSHandler

func NewWSHandler(
	logger zerolog.Logger,
	api state_stream.API,
	subscribeFunc SubscribeHandlerFunc,
	chain flow.Chain,
	stateStreamConfig backend.Config,
	maxRequestSize int64,
) *WSHandler

func (*WSHandler) ServeHTTP

func (h *WSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP function acts as a wrapper to each request providing common handling functionality such as logging, error handling, request decorators

type WebsocketController

type WebsocketController struct {
	Api               state_stream.API               // the state_stream.API instance for managing event subscriptions
	EventFilterConfig state_stream.EventFilterConfig // the configuration for filtering events

	HeartbeatInterval uint64 // the interval to deliver heartbeat messages to client[IN BLOCKS]
	// contains filtered or unexported fields
}

WebsocketController holds the necessary components and parameters for handling a WebSocket subscription. It manages the communication between the server and the WebSocket client for subscribing.

func (*WebsocketController) SetWebsocketConf

func (wsController *WebsocketController) SetWebsocketConf() error

SetWebsocketConf used to set read and write deadlines for WebSocket connections and establishes a Pong handler to manage incoming Pong messages. These methods allow to specify a time limit for reading from or writing to a WebSocket connection. If the operation (reading or writing) takes longer than the specified deadline, the connection will be closed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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