You are not logged in.
Pages: 1
Hello,
I am new to mORMot and found this framework during research for a DataSnap replacement. Because DS is slow and... oh I am sure you all know why...
My application is only publishing services and I need to live with some circumstances (e.g. to return plane text). Everything is fine and works perfectly. But... the only thing is that it seems the socket gets closed after 20 or 30 seconds. Then the next call to the function needs 1,0s instead of 30ms. Of course it would be fine to keep it alive for about 30min. I am not able to find how I am able to keep the connection alive?
I connect to the service within an asp.net website. Using the DataSnap solution the connection stays alive, so I think there is a setting missing in one of the components of the mORMot framework. Please can anyone help me to solve this?
Thanks in advance,
Daniela
TMyService = class(TSQLRestServerFullMemory)
private
public
published
procedure Test(Ctxt: TSQLRestServerURIContext);
end;
procedure TMyService .Test( Ctxt: TSQLRestServerURIContext );
begin
if UrlDecodeNeedParameters(Ctxt.Parameters,'strParam') then
Ctxt.Returns(DoSomething( Ctxt.InputUTF8['strParam']),
HTML_SUCCESS,
TEXT_CONTENT_TYPE_HEADER)
else Ctxt.Error('Missing Parameter');
end;
var
fModel: TSQLModel;
fRestServer: TSQLRestServer;
fHttpServer: TSQLHttpServer;
begin
try
SQLite3Log.Family.Level := LOG_VERBOSE;
SQLite3Log.Family.PerThreadLog := ptIdentifiedInOnFile;
fModel := TSQLModel.Create([],'root');
try
fRestServer := TMyService.Create(fModel);
try
fRestServer.CreateMissingTables;
fHttpServer := TSQLHttpServer.Create('9000',[fRestServer],'+',useHttpApiRegisteringURI);
try
fHttpServer.AccessControlAllowOrigin := '*';
writeln('Server is running at port 9000.');
write('Press [Enter] to close the server.');
readln;
finally
fHttpServer.Free;
end;
finally
fRestServer.Free;
end;
finally
fModel.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
// sample code from the webserver....
HttpWebRequest myHttpWebRequest1 = (HttpWebRequest)WebRequest.Create(cmdLink);
myHttpWebRequest1.KeepAlive = true;
HttpWebResponse myHttpWebResponse1 = (HttpWebResponse)myHttpWebRequest1.GetResponse();
Stream streamResponse = myHttpWebResponse1.GetResponseStream();
StreamReader streamRead = new StreamReader(streamResponse);
string result = streamRead.ReadToEnd();
streamRead.Close();
return result;
Pages: 1