Documentation
¶
Overview ¶
Package websocketin contains the websocketIn node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WebSocketInConfig ¶
type WebSocketInConfig struct {
// Path is the endpoint path that accepts upgrades (default "/ws").
Path string `json:"path"`
// Port is the node's own listen port (default 8082). Like
// httpTrigger the node binds its own listener rather than sharing
// the admin mux, which flowrunner has no reference to.
Port int `json:"port"`
// AllowedOrigins is a comma-separated list of Origin host
// patterns passed to websocket.Accept. Empty keeps the legacy
// any-origin behaviour (Node-RED parity, but a CSWSH exposure —
// set it whenever browsers on foreign origins must not connect).
AllowedOrigins string `json:"allowedOrigins"`
// Server references a shared websocketListener config node id
// (Node-RED "server"): the node receives frames from clients of
// that shared endpoint instead of binding its own port.
Server string `json:"server"`
// Client references a shared websocketClient config node id
// (Node-RED "client"): the node dials out and emits whatever the
// remote server sends (client mode). Client wins over Server.
Client string `json:"client"`
}
WebSocketInConfig holds configuration for the websocketIn node.
type WebSocketInNode ¶
WebSocketInNode runs its own HTTP server that upgrades connections on the configured path and emits every received ws message downstream with the connection's session id in Metadata.
func NewWebSocketInNode ¶
func NewWebSocketInNode(node nodestore.NodeInterface, config *WebSocketInConfig, host nodebase.NodeHost) *WebSocketInNode
NewWebSocketInNode creates a new websocketIn node
func (*WebSocketInNode) Execute ¶
func (n *WebSocketInNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute binds the listener and starts the HTTP server. Binding is synchronous so a port conflict surfaces as a deploy error.
func (*WebSocketInNode) Stop ¶
func (n *WebSocketInNode) Stop() error
Stop shuts down the HTTP server and closes every registered session.
func (*WebSocketInNode) Validate ¶
func (n *WebSocketInNode) Validate() error
Validate checks the websocketIn node configuration