You are not logged in.
Pages: 1
I recompile my code after an upgrade of the repository and with the actual release the OnWebSocketsClosed event is not fired.
Client := TSQLHttpClientWebsockets.Create(strHostName, strPortNumber, TSQLModel.Create([TSQLWatchDog]));
Client.Model.Owner := Client;
Client.WebSocketsUpgrade (TRANSMISSION_KEY);
Client.OnWebSocketsClosed := OnWebSocketsClosed;
If I recompile with old release (from January 2019) the event is fired as expected.
Am I miss something?
(Compiler : Delphi 10.3 Community Edition)
Offline
Thanks for your quick reply.
I followed your suggestion but the result is the same, so I don't think it depends on the order of the two operations, also because otherwise it wouldn't work even with the previous version.
The behavior is different in the function TWebSocketProcessClientThread.Execute (in SynBidirSock.pas unit)
Old Release: fProcess.ProcessLoop Exit with sockerror <> 0 and trigger the OnWebSocketsClosed event
Current Release : fProcess.ProcessLoop continue iteration (sockerror = 0)
I will try to investigate by myself, but any help is welcome.
Offline
I have similar problem: TWebCrtSocketProcess.ProcessLoop does not properly detect network errors and not finished.
Instead, all requests completed with error "'Not Found' (404 - Network problem or request timeout)".
Online
In SynCrtSock unit, function TCrtSocket.SockReceivePending return cspNoData in case of broken connection.
Previous release return cspDataAvailable that is correctly handled and generate the notification of OnWebSocketsClosed.
Something is not ok after the Select function call
res := Select(fSock+1,@fdset,nil,nil,@tv);
if res<0 then
result := cspSocketError else
if (res>0) and(fdset.fd_count=1) and (fdset.fd_array[0]=fSock) and
(IoctlSocket(fSock,FIONREAD,pending)=0) and (pending>0) then
result := cspDataAvailable else
result := cspNoData;
Offline
I change function TWebSocketProcess.NotifyCallback so that it returns STATUS_NOTIMPLEMENTED when SendFrame failed, indicating that connection broken. Patch:
--- SynBidirSock.org
+++ SynBidirSock.pas
@@ -2435,8 +2435,10 @@ begin
try
if (i>2) and (WebSocketLog<>nil) then
WebSocketLog.Add.Log(sllWarning,'NotifyCallback with fProcessCount=%',[i],self);
- if not SendFrame(request) then
+ if not SendFrame(request) then begin
+ result := STATUS_NOTIMPLEMENTED;
exit;
+ end;
if aMode=wscBlockWithoutAnswer then begin
result := STATUS_SUCCESS;
exit;
You can try. If it helps, then we can create pull request.
Last edited by Chaa (2019-04-18 09:33:12)
Online
I try your code but no luck in my case.
Unfortunately I have no time now for further investigation so I must stay on the January release.
Offline
Pages: 1