TsgcWSPClient_STOMP_RabbitMQEvents › OnRabbitMQDisconnected

OnRabbitMQDisconnected Event

Fires when the RabbitMQ STOMP session is closed; reports the underlying WebSocket close code.

Syntax

property OnRabbitMQDisconnected: TsgcWSRabbitMQDisconnectedEvent;
// TsgcWSRabbitMQDisconnectedEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object

Default Value

Remarks

Raised when the RabbitMQ STOMP session ends, either because the client called Disconnect (graceful shutdown after the matching RECEIPT) or because the underlying WebSocket connection was torn down. Parameters:

Use this event to update UI state, stop timers or trigger reconnection logic.

Example

procedure TForm1.RabbitMQDisconnected(Connection: TsgcWSConnection; Code: Integer);
begin
  Memo1.Lines.Add(Format('RabbitMQ disconnected (code=%d)', [Code]));
  if Code <> 1000 then
    Memo1.Lines.Add('Unexpected disconnect — will try to reconnect.');
end;

Back to Events