workflowpluginwebsocket

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package workflowpluginwebsocket provides the WebSocket workflow plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWSServerHTTPHandler added in v0.3.3

func NewWSServerHTTPHandler(m WSServerModule) http.Handler

NewWSServerHTTPHandler wraps a WSServerModule as a standard http.Handler.

func NewWebSocketPlugin

func NewWebSocketPlugin() sdk.PluginProvider

NewWebSocketPlugin returns the WebSocket SDK plugin provider.

func StartCtx added in v0.3.3

func StartCtx(ctx context.Context, m WSServerModule) error

StartCtx satisfies context-aware start (no-op wrapper).

Types

type Hub

type Hub interface {
	BroadcastToRoom(room string, msg []byte) int
	// SendTo delivers a message directly to a connection by its ID.
	SendTo(connID string, msg []byte) bool
}

Hub is an exported interface for the WebSocket hub's broadcast capabilities. Satisfied by the internal hub after the ws.server module is initialized.

func GetHub

func GetHub() Hub

GetHub returns the global WebSocket hub once the ws.server module has been initialized. Returns nil if the module has not started yet.

type WSServerHTTPHandler added in v0.3.3

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

WSServerHTTPHandler is an http.Handler adapter for WSServerModule. It satisfies the workflow engine's module.HTTPHandler interface via module.NewHTTPHandlerAdapter.

func (*WSServerHTTPHandler) ServeHTTP added in v0.3.3

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

ServeHTTP delegates to the underlying WSServerModule.

type WSServerModule added in v0.3.3

type WSServerModule interface {
	sdk.ModuleInstance
	// ServeHTTP handles WebSocket upgrade requests.
	ServeHTTP(w http.ResponseWriter, r *http.Request)
	// HTTPPath returns the path this module listens on (e.g. "/ws").
	HTTPPath() string
}

WSServerModule is the public interface for the ws.server module instance. It exposes the HTTP handler methods needed to register the WebSocket upgrade endpoint directly on the host engine's HTTP router.

func NewWSServerModule added in v0.3.3

func NewWSServerModule(name string, config map[string]any) (WSServerModule, error)

NewWSServerModule creates a ws.server module instance that can be registered directly on the host engine's HTTP router. This is the correct way to embed the WebSocket plugin in-process: HTTP upgrade requests cannot cross the gRPC boundary used by external plugins.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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