diff --git a/docs/architecture/invocations.md b/docs/architecture/invocations.md index 437fca8..0db8a70 100644 --- a/docs/architecture/invocations.md +++ b/docs/architecture/invocations.md @@ -101,7 +101,8 @@ OpenFaaS For Enterprise offers authentication using JWT tokens obtained through * [TLS with OpenFaaS](/reference/tls-openfaas) * [Identity and Access Management (IAM)](/openfaas-pro/iam/overview/) -For functions, you should provide your own authentication mechanism, such as a shared token, OIDC, HMAC or basic authentication. +For functions, you can provide your own authentication mechanism, such as a shared token, OIDC, HMAC or basic authentication. +With [OpenFaaS Identity and Access Management (IAM)](https://docs.openfaas.com/openfaas-pro/iam/overview/) you can use the built in [function authentication](https://docs.openfaas.com/openfaas-pro/iam/function-authentication/) to protect your function endpoints. ## FAQ diff --git a/docs/reference/workloads.md b/docs/reference/workloads.md index 434d4fd..16e883e 100644 --- a/docs/reference/workloads.md +++ b/docs/reference/workloads.md @@ -240,3 +240,37 @@ fprocess=env HOME=/home/app Http_X_Forwarded_Proto=https ``` + +### Supported content types + +OpenFaaS supports workloads over HTTP, and most standard content types are supported. + +Since OpenFaaS has no hard limit on function execution duration, it allows for maintaining long-lived connections for streaming over HTTP. + +> **Important**: Always ensure OpenFaaS system and function timeouts are configured appropriately for your streaming workloads. See [Extended timeouts](https://docs.openfaas.com/tutorials/expanded-timeouts/) for details. + +Supported streaming options: + +**Server-Sent Events (SSE)** + +Server-Sent Events enable a function to push one-way event streams to a client. + +- Clients should include an `Accept: text/event-stream` header in their request when starting tht SSE request. +- The function's response `Content-Type` header must be set to `text/event-stream`. Each event data chunk should be prefixed with data: and terminated by two newline characters (\n\n). + +For more details on SSE, refer to [Using Server Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) + +**WebSockets** + +WebSockets provide bidirectional, full-duplex communication between a client and an OpenFaaS function. + +To create a WebSocket-enabled function, you can modify an existing OpenFaaS template or use the `Dockerfile` template as a starting point. + +For a comprehensive guide, check out: [How to Integrate WebSockets with Serverless Functions and OpenFaaS](https://www.openfaas.com/blog/serverless-websockets/) + +**Newline Delimited JSON (NDJSON)** + +NDJSON (or JSON Lines) is a format for streaming multiple independent JSON objects, each on a new line. + +- Clients should include an `Accept: application/x-ndjson` header in their request. +- The function's response `Content-Type` header should be set to `application/x-ndjson`. Each line in the response should be a complete JSON object followed by a newline character (\n).