Delphi Callback Server using HTTP Protocol Always timeout after a few minutes

491 Views Asked by At

I have problem with setting Callback Server in Delphi Tokyo. I've setup a Datasnap WebBroker Server, then i use

FDSCallBackClientManager.RegisterCallback(sCallbackID,FDSCallBack);

on my client to connect callback server, it can connect and i can send a broadcast message to other client, but after a few minutes since connected, it will disconnected, when i try to broadcast message it will raise an exception telling that the communication is timeout.

I'm using HTTP protocol for the connection, this is not happening when using TCP/IP protocol. The code is just the wizard to create webbroker application targeting Apache. Here the code for the SQLConnection :

FConnection.Params.Values['CommunicationIPVersion'] := 'IP_IPv4';
  FConnection.Params.Values['Hostname'] :=
    TCSClass_Configuration.ReadConfig(
      ClientVariables.Config.FileName,
      AProfile,
      'Hostname',
      'localhost'
    );
  FConnection.Params.Values['Port'] :=
    TCSClass_Configuration.ReadConfig(
      ClientVariables.Config.FileName,
      AProfile,
      'WebPort',
      '80'
    );
  FConnection.Params.Values['DatasnapContext'] :=
    TCSClass_Configuration.ReadConfig(
      ClientVariables.Config.FileName,
      AProfile,
      'DatasnapContext',
      'datasnap'
    );
  FConnection.Params.Values['URLPath'] :=
    TCSClass_Configuration.ReadConfig(
      ClientVariables.Config.FileName,
      AProfile,
      'URLPath',
      'rest'
    );
  FConnection.Params.Values['ConnectTimeout'] :=
    TCSClass_Configuration.ReadConfig(
      ClientVariables.Config.FileName,
      AProfile,
      'ConnectTimeOut',
      '1000'
    );
  FConnection.Params.Values['CommunicationTimeout'] :=
    TCSClass_Configuration.ReadConfig(
      ClientVariables.Config.FileName,
      AProfile,
      'CommunicationTimeOut',
      '1000'
    );

And here the code to connect to callback server:

FDSCallBackClientManager.ChannelName := FCallbackChannelName;
FDSCallBackClientManager.DSHostname :=
  FConnection.Params.Values['Hostname'];
FDSCallBackClientManager.DSPort :=
  FConnection.Params.Values['Port'];
FDSCallBackClientManager.DSPath :=
  FConnection.Params.Values['URLPath'];
FDSCallBackClientManager.CommunicationProtocol :=
  FConnection.Params.Values['CommunicationProtocol'];
FDSCallBackClientManager.ConnectionTimeout :=
  FConnection.Params.Values['ConnectTimeout'];
FDSCallBackClientManager.CommunicationTimeout :=
  FConnection.Params.Values['CommunicationTimeout'];

sManagerID := TDSTunnelSession.GenerateSessionId;
sCallbackID := TDSTunnelSession.GenerateSessionId;

FDSCallBackClientManager.ManagerId := sManagerID;

if FDSCallBack = nil then
begin
  FDSCallBack := TCSClass_Callback.Create(
    Self,
    sManagerID,
    sCallbackID
  );
end;
FDSCallBackClientManager.RegisterCallback(sCallbackID,FDSCallBack);

So can anyone give me some advice what am i missing?

0

There are 0 best solutions below