You are not logged in.
Pages: 1
Sorry but I did not understand if you have already implemented the function of pushing the server to the client?
http://blog.synopse.info/post/2012/09/0 … laboration
thanks Corchi72
Offline
ok Thanks
Then I can insert into (specific) client another server (type THttpApiServer) without authentication, and without tables, that receives impulses from the real server?
fServer := THttpApiServer.Create(false);
fServer.AddUrl('root','888',false,'+',true);
fServer.RegisterCompress(CompressDeflate); // our server will deflate html :)
fServer.OnRequest := Process;
fPath := IncludeTrailingPathDelimiter(Path);
and then work with the interfaces?
Last edited by corchi72 (2013-07-03 13:49:06)
Offline
You can do this, but you will need to do all the firewall settings to access your client from the server side.
Just uses a TSQLRestServerFullMemory instance on the client side, so you won't need any link to SQLite3 in the executable, but still have the whole routing and authentication if needed.
See the samples using this kind of class.
A blank THttpApiServer won't be enough to serve interface based services (or method-base services), just to send some content over HTTP.
Offline
don't work , I must to create table with "CreateMissingTables" ([TSQLAuthUser,TSQLAuthUser])
var
aModel: TSQLModel;
aDB: TSQLRestServer;
aServer: TSQLHttpServer;
begin
// initialize the ORM data model
aModel := TSQLModel.Create([TSQLAuthUser,TSQLAuthUser],ROOT_NAME);
try
// create a fast in-memory ORM server
aDB := TSQLRestServerFullMemory.Create(aModel,'xxx.json',false,true);
aDB.CreateMissingTables(ExeVersion.Version.Version32);
// launch the HTTP server
aServer := TSQLHttpServer.Create(inttostr(888+1),[aDB],'+',useHttpApiRegisteringURI);
aServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
aDB.ServiceRegister(TRemoteAction,[TypeInfo(IRemoteAction)],sicShared);
finally
aModel.Free;
end;
sorry but what should I write to connect from the client and use the interface
I wrote the following code but an error occurs I can not run the setuser:
var
Client:TSQLHttpClient;
aModel: TSQLModel;
sServer: AnsiString;
I:IRemoteAction;
begin
sServer := 'localhost';
try
aModel := TSQLModel.Create([],ROOT_NAME);
try
Client := TSQLHttpClient.Create(sServer,inttostr(888+1) ,aModel);
if Client.SetUser('Admin','Synopse') then
Client.ServiceRegister([TypeInfo(IRemoteAction)],sicShared);
if not Client.Services['RemoteAction'].Get(I) then
exit;
I.Update(ID);
finally
Client.Free;
end;
finally
aModel.Free;
end;
end;
Offline
the server side, I recorded the following interface. the interface performs a process that takes 1 minute and everything works, but after a few seconds an error occurs 12001 of face + interface name call ..
Why?
procedure TDMDServer.CreateServerInMemory;
begin
with TSQLLog.Family do begin
Level := [sllError,sllInfo,sllDebug]; //LOG_VERBOSE
EchoToConsole := [sllError,sllInfo,sllDebug];
AutoFlushTimeOut := 2;
DestinationPath := GetTempDir;
OnArchive := EventArchiveSynLZ;
//OnArchive := EventArchiveZip;
ArchiveAfterDays := 1; // archive after one day
end;
// initialize the ORM data model
MemoryModel := TSQLModel.Create([],ROOT_NAME);
try
// create a fast in-memory ORM server
MemoryDB := TSQLRestServerFullMemory.Create(MemoryModel,'Memory',false,false);
// register our TRemoteAction implementation
MemoryDB.ServiceRegister(TRemoteAction,[TypeInfo(IRemoteAction)],sicShared);
// launch the HTTP server
MemoryServer := TSQLHttpServer.Create(inttostr(fNuvRegistry.ScheduleServerHttpPort),[MemoryDB],'+',useHttpApiRegisteringURI);
MemoryServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
except
end;
end;
Offline
No I was wrong to writing the process takes about 1 minute, but the error occurs after a few seconds
Offline
What is the status about pushing from server to the client functionality? :-)
Offline
This can hep too me.
Offline
Feature is listed, but not yet implemented.
This is not on our high-priority list!
(remember we are not paid for the framework, so we maintain our own priority list for features, unless we are asked and paid for a specific feature - see http://blog.synopse.info/post/2014/02/2 … -free-beer )
But this may be a very useful feature.
In the meanwhile, you can define a timer to periodically ask the server for updates.
This is what we do in our current implementations, and is still stateless.
Offline
Pages: 1