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.
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.
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.