push_stream_footer_template
Defines the template for footer messages in push stream responses.
Description
The push_stream_footer_template directive allows users to specify a custom HTML footer template for messages transmitted over the push stream. When a subscriber receives a message, this footer template will be appended to the message content before it is sent to the client. This feature is particularly useful for injecting additional HTML or JavaScript content that should be included in the final output, such as closing tags or scripts needed to handle further interactions on the client side.
The footer template can contain any valid HTML content, and it can be designated as either a static template or one that includes dynamic values based on the subscription state. This flexibility allows developers to enhance the user experience by providing context-sensitive details or resources that enrich the streaming data.
To use this directive, it can be specified within the http, server, or location contexts as appropriate to the application's architecture. The argument to this directive must be a single string representing the footer template. The proper handling of HTML entities and escapes should be considered to ensure that the resulting output is valid HTML.
Config Example
http {
push_stream_footer_template "";
server {
location /sub {
push_stream_subscriber;
push_stream_channels_path $arg_channel;
}
}
}Ensure the footer template is valid HTML to avoid rendering issues in the client.
Be cautious with the dynamic content to prevent XSS vulnerabilities if user input is involved.