Click or drag to resize
ServiceListenerOnHTTPRequest Method

Triggered when an HTTP connection is made that does not attempt to upgrade the connection to the WebSocket protocol.

Namespace: OIV.RemoteViz.Rendering
Assembly: OIV.RemoteViz (in OIV.RemoteViz.dll) Version: 10.12.3.0 (10.12.3.0)
Syntax
public virtual HTTPResponse OnHTTPRequest(
	HTTPRequest httpRequest
)

Parameters

httpRequest
Type: OIV.RemoteViz.RenderingHTTPRequest

HTTP request message

Return Value

Type: HTTPResponse

HTTP response message

Remarks

This allows a service to respond to these requests with regular HTTP responses. It can be useful, for example, to manage health checks:

Health checks are usually used with an external monitoring service or container orchestrator to check the status of the service. They periodically invoke the endpoint to check the health of the service instance.

In a Kubernetes environment, a pair of health checks are used that distinguish between two states:

  • The service is functioning but not yet ready to receive requests. This state is the service's readiness.

  • The service is functioning and responding to requests. This state is the service's liveness.

This method is not suitable to serve high volume requests or HTTP resources, in these cases, prefer a dedicated HTTP server like Apache or Nginx. Only HTTP 1.0 features are supported (status code, method, content type and headers). Connections are terminated immediately after the response.

Default behavior : returns an OIV.RemoteViz.Rendering.HTTPResponse with "404 NOT FOUND" status.

IMPORTANT: This listener is executed in a separate thread. It gives your program the chance to perform longer calculations without blocking other network operations.

See Also