Documentation
¶
Index ¶
Constants ¶
View Source
const ( // WebSocket configuration values used across handlers WriteWait = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CloseWithMessage ¶
CloseWithMessage closes the WebSocket connection with a specific close code and message
func GetUpgrader ¶
GetUpgrader returns a websocket upgrader with configurable CORS
Types ¶
type ConnectionParams ¶
type ConnectionParams struct {
Writer http.ResponseWriter
Request *http.Request
Resolved *types.ResolvedStream
Fetch func(context.Context) (proto.Message, error)
}
ConnectionParams contains parameters for establishing a WebSocket connection
type Handler ¶
type Handler struct {
Logger log.Logger
Registry *types.SubscriptionRegistry
AppContextDone <-chan struct{}
Upgrader *websocket.Upgrader
}
Handler contains the shared state required to service WebSocket connections
func (*Handler) ServeConnection ¶
func (h *Handler) ServeConnection(params ConnectionParams) (retErr error)
ServeConnection handles the standard WebSocket connection lifecycle
type RouteDefinition ¶
type RouteDefinition struct {
Pattern string
Handler RouteHandler
}
RouteDefinition defines a WebSocket route with its pattern and handler.
func BuildWSRoutes ¶
func BuildWSRoutes( handler *Handler, registry *encoding.DynamicRegistry, invoker *types.RouterInvoker, logger log.Logger, ) []RouteDefinition
BuildWSRoutes produces websocket routes based on the OpenAPI specification.
type RouteHandler ¶
type RouteHandler func(http.ResponseWriter, *http.Request)
RouteHandler defines a function that handles a specific route.
Click to show internal directories.
Click to hide internal directories.