TsgcWSPServer_sgcEvents › OnConnect

OnConnect Event

Fires after a client completes the WebSocket handshake for this subprotocol.

Syntax

property OnConnect: TsgcWSConnectEvent;
// TsgcWSConnectEvent = procedure(Connection: TsgcWSConnection) of object

Default Value

Remarks

Raised once per accepted connection after the subprotocol sends its session identifier and drains any queued retained publications. When a Broker is assigned the event is suppressed so the broker pipeline can own the handshake; otherwise this is the right place to inspect Connection.Guid, Connection.PeerIP or custom headers attached by the HTTP upgrade.

Example

procedure TForm1.oProtocolConnect(Connection: TsgcWSConnection);
begin
  Memo1.Lines.Add('connected: ' + Connection.Guid);
end;

Back to Events