#1 2014-01-22 19:21:43

brunovix
Member
Registered: 2014-01-22
Posts: 5

Remoting for FireMonkey (iOS)

Hi!

Do you have any plans to support FireMonkey iOS?

I think this is a big market and DataSnap performs really bad over slow connections (3G). For lots of data and users it's impraticable.

FireMonkey is an easy option to pick if you want to build nice multitiered database applications for iOS. But DataSnap is not.

Other options are RemObjects and RealThinClient.

Thank you!

Bruno

Offline

#2 2014-01-23 09:30:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Remoting for FireMonkey (iOS)

This is on the road map.
See http://synopse.info/fossil/tktview?name=09ae8513eb

Our RESTful API is pretty easy to work with.
You can easily consume interface-based services from any client, with URI-encoded parameters.
See http://blog.synopse.info/post/2014/01/0 … d-services

I suppose Indy is able to work on iOS/Android so you can access mORMot services from HTTP very easily.
Or you can access directly the native iOS API, which I suppose is more lightweight and integrated - see http://developer.apple.com/library/ios/ … uests.html
Take also a look at http://sourceforge.net/projects/dpfdelphiios/ which has a native HTTP component for iOS.

You are right: on the server side, mORMot is certainly an amazing option about stability and speed, especially if you integrate it with SQL requests (since our DB layers are able to emit directly JSON content).
And our interface based services are very easy to write.

Offline

#3 2014-01-23 15:52:37

brunovix
Member
Registered: 2014-01-22
Posts: 5

Re: Remoting for FireMonkey (iOS)

Thank you!

I'll take a look.

Good luck!

Bruno

Offline

#4 2014-01-23 19:04:40

brunovix
Member
Registered: 2014-01-22
Posts: 5

Re: Remoting for FireMonkey (iOS)

Arnaud, can you tell me the steps to convert a DataSnap application to mormot? I already downloaded your thousand pages pdf but i'm still confused.

At first, it seems that remobjects and realthinclient are easier for me to convert. But I want to use mormot because I have others bigger projects too.

This small project I want to convert is already running and consists of:

DB: Sql Server Database - Will not be changed
Client: Windows Application (Delphi using ADO) - Will not be converted to mormot because is used via LAN

Server: Windows Service Application (Delphi using dbexpress and datasnap) - Will be converted to mormot
Client: FireMonkey iOS Application (Delphi using datasnap) - Will need changes to connect to mormot and discard datasnap

Currently, the firemonkey ios app downloads a "one time load" (or when really needed, per week or month) via datasnap some tables that are not changed much, one has 9000 records (700kb). After configuring server, port, user and password. I save this to binary cds files in the ios app folder.
1) The ios app connects to datasnap server;
2) Call the datasetprovider that is connected to a tsqlquery via a clientdataset;
3) Open the clientdataset;
4) Save the clientdataset to disk (binary);
5) Close the clientdataset;
6) Close the datasnap connection to server (stateless).
Repeat the four steps to each table.

When I need, I call ClientDataSetX.LoadFromFile and show the table to the user, offline. No datasnap connections required here to perfom better.

Then, some operations in the ios app need a call to a method declared in the datasnap server using a TSqlServerMethod component. The method in the server runs a stored procedure to include a record in the table like:

In the server:
function TServerMethods1.IncludeDevLoja(Data: TDateTime; CodCaixa: string;
  Quantidade: integer; out Ret: string): boolean;
var
  Trans: TDBXTransaction;
begin
  result := false;
  ret := '';

  Trans := dbconn.BeginTransaction;
  try
      if SpCxIncluirDevLoja.Active then SpCxIncluirDevLoja.Close;
      SpCxIncluirDevLoja.Params.ParamByName('@Data').AsDateTime := Data; // date
      SpCxIncluirDevLoja.Params.ParamByName('@CodCaixa').AsString := CodCaixa; // code
      SpCxIncluirDevLoja.Params.ParamByName('@Quantidade').AsInteger := Quantidade; // quantity
      SpCxIncluirDevLoja.Prepared := true;
      SpCxIncluirDevLoja.ExecProc;

      dbconn.CommitFreeAndNil(Trans);

      result := true;
      ret := 'Devolução de Loja incluída com sucesso.'; // success
  except
      on E: exception do
      begin
        DoLog('Function IncludeDevLoja. ' + E.Message,ltError);
        ret := E.Message;
        dbconn.RollbackFreeAndNil(Trans);
      end;
  end;
end;

I run the method and disconnect from the datasnap server (stateless).

But using 3G datasnap performs really bad.

This is my scenario.

Can you help?
What are the correct steps to successfully convert to mormot?
What would you do?

Thank you!

Bruno

Offline

#5 2014-01-23 20:36:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Remoting for FireMonkey (iOS)

Your request is much more complex than I expected.

You need offline connection to the DB, right?
There is no direct way of using it.

I suppose DBX / DataSnap is very heavy for a mobile platform.

So you need additional logic on the client side.
The mORMot core itself is not available yet on iOS, and I doubt it will be soon, since I do not need it (I prefer HTML5/SmartMobileStudio apps for such clients).

Offline

#6 2014-01-24 10:42:43

brunovix
Member
Registered: 2014-01-22
Posts: 5

Re: Remoting for FireMonkey (iOS)

With SMS/HTML5 the app runs stateless?

DataSnap is very heavy for mobile. Sometimes it slows down and a simple call to a remote procedure that executes a stored procedure takes seconds.

Thank you Arnaud!

Bruno

Offline

#7 2014-01-24 12:06:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Remoting for FireMonkey (iOS)

brunovix wrote:

With SMS/HTML5 the app runs stateless?

In fact, the whole mORMot point of view is to be stateless.
See the corresponding paragraphs in the SAD 1.18 pdf (search by the keyword index at the beginning of the doc).

With HTML5 you can have some local storage, but it is limited to 5MB AFAIR.

Offline

#8 2014-01-27 11:21:05

brunovix
Member
Registered: 2014-01-22
Posts: 5

Re: Remoting for FireMonkey (iOS)

Arnaud, I'll use pure Indy instead of Datasnap for now. For this project I don't need scalability.

A Windows Service TCP Server;
A Firemonkey iOS TCP Client;
The client sends a function to the server;
The server opens a connection to database, execute a query using TDatasetProvider+TClientDataset, save to stream, compress the stream using TZCompressionStream and send back to client, close the TClientDataset;
The client receives the stream, decompress it, opens a TClientDataset from stream without a provider. I save to disk if the table is big enough and doesn't change much.

It works a lot better than DataSnap and is stateless.

Maybe in the future I try mormot in projects that need it.

Thank you!

Bruno

Offline

Board footer

Powered by FluxBB