#1 2021-03-03 03:43:58

AntonE
Member
Registered: 2012-02-03
Posts: 74

mORMot2 recommended FMX-Client(WS?)

Hi all,
SHORT:
Q1) Best server/client setup in mORMot2 for secure Server[Winx64]/Client[FMX Android].
Q2) How to wire-up 3rd party WebSocket client-component into mORMot2?

LONG:
Q1)I need to start a new multi-platform (Win/Android) Client app in Firemonkey, server running on Windows.
I've been trying to get WebSockets working with mORMot1 Android, installed Certificates and have bought latest scgWebsockets license for an Android WebSockets client.
Coming here for help, I discovered mORMot2! Congrats and thank you! So it makes me think if some new development might make a difference here.

The app's storage+network must be fully encrypted (preferably end-to-end for net) and async WebSockets would be ideal, with the usual mORMot TRest and InterfacedBasedServices.
All clients will be mORMot compiled for Win/Android/macOs.

What would be the recommended secure server/client setup be, especially for Android?
I've read before that one need to compile mORMot's WebSocket client in Larazus which can be used in Delphi FMX/Android? Is this still the case?

Q2) Alternatively; How can I 'wire-up' scgWebsocketClient in Android so the rest of my code work with a TRest mORMot class/intf as usual?

Thanks, hope it make sense.

Last edited by AntonE (2021-03-03 03:48:37)

Offline

#2 2021-03-03 07:02:00

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

Re: mORMot2 recommended FMX-Client(WS?)

SHORT:
Q1) HTTPS using http.sys on the server
Q2) Use the AJAX JSON protocol on the server side, then it will be easily consumed by any WS client.

See TWebSocketProtocolJson.FrameCompress/FrameDecompress in mormot.ws.core.pas for the raw JSON format, and how it is used in TWebSocketProtocolRest.InputToFrame/FrameToOutput:

  FrameCompress(head, [{%H-}Method, Ctxt.Url, Ctxt.InHeaders, ord(aNoAnswer)],
    Ctxt.InContent, InContentType{%H-}, request);
...
  FrameCompress(outhead, [Status, Ctxt.OutCustomHeaders], Ctxt.OutContent,
    OutContentType{%H-}, answer);

Then the internal JSON of Ctxt.InContent/Ctxt.OutContent will follow the regular mORMot JSON serialization of the REST requests, as defined in the doc.
The interface callbacks indeed share the very same JSON layout: it is a regular REST JSON Call, just from server to client.

Offline

#3 2021-09-08 10:31:57

mongkey
Member
Registered: 2021-08-26
Posts: 17

Re: mORMot2 recommended FMX-Client(WS?)

I tried synrestdataset on lazarus LAMW, smile had no luck, need more times to tame this mormot smile -> i'm gonna use dart/js sample provided by ab translate into LAMW httpclient.

By the way your sample (antonE) on LAMW not work on latest LAMW, eror on creating server. 1 year ago was fine.

Last edited by mongkey (2021-09-08 10:35:44)

Offline

#4 2021-09-09 04:12:49

mongkey
Member
Registered: 2021-08-26
Posts: 17

Re: mORMot2 recommended FMX-Client(WS?)

All work for now on LAMW, flutter, need dig deeper on mormot security, thank you AB!

Offline

#5 2021-09-09 07:22:09

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: mORMot2 recommended FMX-Client(WS?)

It would be nice if you could share the changes that were needed to get things working again.
Thanks !

Offline

Board footer

Powered by FluxBB