push_stream_last_received_message_tag

The `push_stream_last_received_message_tag` directive configures NGINX to keep track of the last received message tag for subscribers in the Push Stream module.

Syntaxpush_stream_last_received_message_tag value;
Defaultnone
Contexthttp, server, location, if in location
Arguments1

Description

The push_stream_last_received_message_tag directive is used to manage message tracking for subscribers in the NGINX Push Stream module, particularly in situations where subscribers need to identify the last message they received on a specific channel. By setting this directive, subscribers can maintain a continuous connection and effectively manage message delivery without missing updates, which is crucial in real-time applications where message order and integrity are vital.

When a subscriber connects, the value set for this directive determines how the last message tag is stored and managed in the session. This can enhance user experience by ensuring that new messages sent to a channel are accurately delivered to each subscriber, especially after reconnections. For instance, if a subscriber disconnects and reconnects, the last received message can be referenced so that they can fetch updates from where they left off without redundantly processing already received messages.

This directive accepts a single argument that defines the behavior for tracking the last received message. The proper implementation of this directive can greatly reduce the chances of message loss or duplication in a high-throughput messaging environment. It is important to note that while this directive is helpful for ensuring reliable message delivery, it should be used judiciously to optimize performance and resource usage.

Config Example

http {
    push_stream_last_received_message_tag on;
    server {
        location /pub {
            push_stream_publisher admin;
        }
        location /sub {
            push_stream_subscriber;
            push_stream_last_received_message_tag on;
        }
    }
}

Ensure that the directive is set properly within the correct context (http, server, location) to avoid unexpected behavior.

Misconfiguring this directive may lead to message duplication or loss after subscriber reconnections.

Incompatible configurations with other directives related to message tracking may lead to unforeseen issues.

← Back to all directives