Extend structure in structure/array/RoComplexType

Maybe a silly question.
Given an existing service/client application with 100rds of existing clients. One have to re-write the client app. The old clients have to to continue to exist . The new clients do need more information from the server and so on.
Example: On client login an out param with a GOD structure will be created on server side. Lets say one element of this structure is an object (TComplexType) wrapped in an array. This object needs more fields now. How to handle it?
Do i have to create a new login method for the new clients with a new structure? Or is there an easier way possible to do this?
Delphi 11.1 (server and new client) with RO 10.0.0.1537, no Code first.

Hi,

If your login string (like we use in Data Abstract) supports parameters like

user=user1;password=password1;extraparam=value;

better to pass client version in login string so server can recognize version of client.
by other hand, you can pass some info in HTTP headers. Indy HTTP client allows to pass extra data in HTTP headers.

Note: Check Receiving information about client on server-side snippet. it shows how to read HTTP headers on server-side.

Client version can be stored inside session.

Note: The Session Types sample (Delphi) shows how to read and store values inside session.

if you know what version client is used (old or new), you can use original struct or his descendant with extra fields as a members of your array depending on client version.

as a result,

  • old clients will receive original struct
  • new clients will receive descendant of original struct with extra fields.

in this case, you should change nothing - new client will read server response and create descendant with extra fields.

this way is more suitable for updates with breaking changes.


this way is suitable for one time changes


3rd way can be in combining above solutions: introduce a new login method that accepts client version.

this way is more suitable for updates with breaking changes and allows to pass client version to server in easy mode w/o using HTTP headers.