TsgcWSPClient_sgcMethods › GetLastOffset

GetLastOffset Method

Returns the last message offset the client has seen on a channel.

Syntax

function GetLastOffset(const aChannel: String): Int64;

Parameters

NameTypeDescription
aChannelconst StringName of the channel whose tracked offset is returned.

Return Value

The last offset received on the channel. Returns 0 when the client has not yet received any message on the channel (or when Message History is not enabled on the server).

Remarks

The client keeps a per-channel cursor with the offset of the last message it received while Message History is enabled on the server. This cursor is what a plain Subscribe sends on reconnection so the server replays only the messages the client missed. Use GetLastOffset to inspect that cursor, for example to persist it across application restarts or to drive an explicit Subscribe(aChannel, aSinceOffset) replay.

In .NET the matching SetLastOffset and ClearOffsets methods let you restore or reset the tracked cursors.

Example

LastOffset := oProtocol.GetLastOffset('news');

Back to Methods