Browse Source

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

mattias 3 years ago
parent
commit
4c9f2b8b25

+ 1 - 1
packages/fcl-web/src/websocket/fpcustwsserver.pp

@@ -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;

+ 2 - 3
packages/fcl-web/src/websocket/fpwebsocketclient.pp

@@ -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