Skip to content

Http listener ​

Embedded web server: listens on a port and path, emits every incoming request as a WebHttpRequest and sends the response it receives back on its Input pin (or from an Http response component). Use it to expose a flow as an HTTP endpoint.

Pins ​

PinKindTypesDescription
StartstartStarts the server. Called by the system at flow start when unconnected.
OutputoutputViaducta.Plugins.Http.Types.WebHttpRequestCalled for every request (after authentication). Connect Rest handler, SOAP handler or your own logic.
InputinputViaducta.Plugins.Http.Types.WebHttpResponse, Viaducta.Plugins.TextPlugin.Types.TextRecordResponse to send to the caller of the current request.
AuthentificatecontinueViaducta.Plugins.Http.Types.WebHttpRequestCalled first for every request. An error here rejects the request.

Configuration ​

FieldTypeDefaultDescription
ListenUrllistener URLRequired. Format http://<host>:<port>/<path>, see below.
MaxParallelRequestsinteger (1-4096)1024Max requests processed in parallel. Further requests wait for a free slot until the caller gives up; open (keep-alive) connections are not limited.
MaxRequestBodySizeinteger0Max body size in bytes, 0 = unlimited (2 GB).
Timeoutinteger60000Ignored, see Notes.
KeepAliveTimeoutinteger130Keep-alive timeout in seconds.
MaxRequestHeaderCountinteger100Max number of request headers.
KeepRawBodybooleanfalsetrue: also put the exact request bytes in ByteBody for text and form requests (Body/Form are still filled, IsByteBody stays false). Turn on when a signature over the body is checked, for example by the Webhook receiver.
UseSslbooleanfalsetrue: HTTPS.
SslProtocoldropdown: 0 None, 12 Ssl2, 48 Ssl3, 192 Tls, 240 Default, 768 Tls11, 3072 Tls12, 12288 Tls130Allowed protocol(s) when UseSsl. 0 = OS default.
ServerCertificatecertificateName of a certificate object in the repository, used when UseSsl.

ListenUrl format ​

The editor writes http://localhost:<port>/<path> for a private listener (local machine only) or http://0.0.0.0:<port>/<path> for a public one (all interfaces), e.g. http://0.0.0.0:9000/api. * or + as host also means all interfaces; any other host must be an IP address. Only one URL is supported. A public listener is also reachable through the designer server at <server>/env/<tenantId>-<environment>/<port>/<path> (shown in the editor as the absolute URL).

Behaviour ​

  • Several listeners (and web socket listeners) in a flow can share a port if they use different paths under the same first segment (/api/orders and /api/users, not /api and /api2) and identical SSL, certificate and visibility settings; otherwise the flow fails to start.
  • For each request: method, full URL, headers, query string, cookies and remote IP are copied into a WebHttpRequest. Form posts fill Form, text content types fill Body, anything else fills ByteBody (IsByteBody = true). A missing content type is treated as text/json. Request headers ViaSessionId and ViaCorrelationId are copied into the flow metadata session and correlation id.
  • Authentificate is called first. Any error returns a JSON error (message, code, type, flowName, componentName, traceId); the status is 401 for errors raised by Http authentification, otherwise 500.
  • Then Output is called. No Output connection: empty 404. If the flow finishes without sending a response: 500 "The response ... was never sent". Errors in the flow: JSON error, 500 (or the error's code if it requests that).
  • The response: StatusCode (0 = 200), headers, cookies, ContentType, Body or ByteBody, ContentFileName (adds Content-disposition: attachment). A TextRecord becomes a 200 with Value as body. Only the first response per request is sent.
  • The plugin keeps the flow running.

Notes ​

  • Timeout is not used: a request waits until the flow finishes.
  • With only one listener on a port, it receives every path on that port, not only its own.
  • With UseSsl and no ServerCertificate, the default development certificate is used and SslProtocol is not applied.
  • Without an Authentificate connection all requests are served (warning shown in the designer).

Example ​

json
{ "ListenUrl": "http://0.0.0.0:9000/api", "MaxParallelRequests": 1024 }

Http listener → Rest handler → ... → Http response

Viaducta documentation