fcl-web: TCustomWSServer.OnDisconnect: pass TCustomWebsocketClient as Sender instead of connection

This commit is contained in:
mattias 2022-08-22 19:29:22 +02:00
parent 8ebced609c
commit 4c9f2b8b25
2 changed files with 3 additions and 4 deletions

View File

@ -248,7 +248,7 @@ Type
Property OnAllow : TWSAllowConnectionEvent Read FOnAllow Write FOnAllow;
// Called when a text message is received.
property OnMessageReceived: TWSMessageEvent read FOnMessageReceived write FOnMessageReceived;
// Called when a connection is disconnected. Sender is TWSServerConnection
// Called when a connection is disconnected. Sender is TCustomWebsocketClient
property OnDisconnect: TNotifyEvent read FOnDisconnect write FOnDisconnect;
// Called when a control message is received.
property OnControlReceived: TWSControlEvent read FOnControl write FOnControl;

View File

@ -271,7 +271,7 @@ begin
If Assigned(MessagePump) then
MessagePump.RemoveClient(FConnection);
If Assigned(OnDisconnect) then
OnDisconnect(Self);
OnDisconnect(FConnection);
// We cannot free the connection here, because it still needs to call it's own OnDisconnect.
end;
@ -294,7 +294,7 @@ begin
FConnection:=CreateClientConnection(FTransport);
FConnection.OnMessageReceived:=@MessageReceived;
FConnection.OnControl:=@ControlReceived;
FCOnnection.OutgoingFrameMask:=Self.OutGoingFrameMask;
FConnection.OutgoingFrameMask:=Self.OutGoingFrameMask;
if UseSSL then
FSocket.Connect;
FActive:=True;
@ -470,7 +470,6 @@ begin
FreeAndNil(FSocket);
end;
procedure TCustomWebsocketClient.Disconnect(SendClose : boolean = true);
begin