You are not logged in.
Pages: 1
Hi, I receive this error once in a while, when testing my application. I test it with several clients, one is calling the server method every 300ms. After 3000-4000 calls I get the error and the client is disconnected from the callback.
maybe I have not set something right?
I am using Delphi 10 Seattle.
Server side:
Model := CreateSampleModel;
database := TSQLRestServerDB.Create(Model);
database.CreateMissingTables;
database.ServiceDefine(TServerMethods,[IServerMethods],sicShared);
database.ServiceDefine(TCallbackService,[ICallbackservice],sicShared).SetOptions([],[optExecLockedPerInterface]).ByPassAuthentication := true;
mORMotServer := TSQLHttpServer.Create('8998',[database],'+',useBidirSocket, 32,secNone,'static');
mORMotServer.WebSocketsEnable(database,PROJECT31_TRANSMISSION_KEY).Settings.SetFullLog;
mORMotServer.AccessControlAllowOrigin := '*';
Client side:
model := CreateSampleModel;
Client := TSQLHttpClientWebsockets.Create('localhost','8998',Model);
try
if not Client.ServerTimeStampSynchronize then
raise EServiceException.Create(
'Error connecting to the server');
Client.Model.Owner := Client;
Client.WebSocketsUpgrade(PROJECT31_TRANSMISSION_KEY);
Client.SetUser('User','synopse');
Client.ServiceDefine([IServerMethods],sicShared);
Client.ServiceDefine([ICallbackService],sicShared);
if not Client.Services.Resolve(ICallbackService,Service) then
raise EServiceException.Create('Service ICallbackService unavailable');
callback := TCallback.Create(Client,ICallback);
TCallback(callback).CallBack := OnCallBack;
Service.Join(pseudo,callback);
Server side method
TServerMethods.editObject(ID: integer; ....): Boolean;
...
result := false;
myObject := TMyObject.create;
try
if database.retrieve(id, myObject) then begin
myObject. = ....
database.update(myObject);
id := myObject.ID;
//service: ICallbackService;
service.Send('kiro','TMyObject:'+inttostr(id)); //broadcast id to clients so they visualize the updated object
result := true;
end;
finally
myObject.free;
end;
...
Last edited by Kikimor (2016-10-17 10:59:07)
Offline
Pages: 1